Making Enemies Follow Player Diagnally
Posted 03 December 2011 - 11:01 PM
Also, I would like for my player to be able to have an inventory they can check and use items from and spells at their disposal.
This is a lot, I know, but I hope you guys can help me out with some of the stuff, please and thank you!
Posted 03 December 2011 - 11:52 PM
Let's assume on a collision with obj_enemy, obj_player goes into battleroom, then goes back to the same position in the same room afterwards.
//Put this in collision with obj_enemy for obj_player var global.memx, global.memy, global.memroom; global.memx = x global.memy = y global.memroom = room //Put this after you're done in the battle room x=global.memx y=global.memy room=global.memroom
For the enemies going in only four directions, put in their step events:
move_towards_point(obj_player.x,obj_player.y,whateverspeedyouwant) direction = floor(direction/4)+45 Randomly drop treasures and inventories require arrays, which I am not very good at. Sorry if the codes here don't work.
Posted 04 December 2011 - 12:24 AM
Posted 04 December 2011 - 02:17 AM
var global.memx; var global.memy; var global.memroom;
And with the whole direction thing, IDK. I'd assume it's because I used two different types of movement. I'm not too good with GML, so I would just trash the diagonal movement, move towards the point of the player, and leave it at that. Sorry for giving you nonworking code
If the vars still don't work, copy and paste the code into the create event for your player object.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users