• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Make player face the right way while pathfinding

Bee

Member
Hello all,
I have built a game where the player targets the nearest enemy and uses Game Maker's pathfinding to make his way there on his own. The problem is that he doesn't face in the direction of his movement but faces his target. What do I use for his direction for his facing (right, up, left, down)?
 

NightFrost

Member
I forget, but didn't motion planning automatically set instance direction to correct value? If so, you can take it and:
Code:
Facing = round(direction / 90);
Where Facing 0 and 4 is right, 1 is up, 2 is left and 3 is down.
 

NightFrost

Member
Also, even if motion planning does not set direction, you can figure it out by doing after mp movement:
Code:
Dir = point_direction(xprevious, yprevious, x, y); // Calculates direction from previous position towards current position
 
Top