GMS 2 Pathfinding (GMS2) (SOLVED)

KPJ

Member
Hi everyone! I am making a top down stealth game where I want the enemy to chase the player (and look at the player) if it is in within range. I don't want to use move_towards_point or mp_potential_step / mp_potential_step_object as they have jittery movement.
So, I tried Heartbeast and Cameron Penner tutorials of pathfinding using grids. this works all fine, however when I try and make the enemy face the player, the grid pathfinding becomes jittery and crazy again. Does anyone know another way for enemy pathfinding?
Thanks!
 

Danei

Member
How are you making them face the player? If you manually draw the sprite at the appropriate angle, without changing the inbuilt angle or scale variables, you ought to be able to draw the sprite in basically any way without affecting pathfinding at all.
 

KPJ

Member
Danei I am using:
direction = point_direction(x, y, oPlayer.x, oPlayer,y);
image_angle = direction;
 

KPJ

Member
RefresherTowe thanks. It worked but I still don't have smooth movement, and the face toward player has become a bit off as well.
 
That line I posted is the -only- thing you need to make the enemy face the player. If you have changed the actual pathfinding code while trying to attempt this, you should change it all back to how it originally was (as you said in your post, it all worked fine to begin with, just the facing thing was wrong).
 
  • Like
Reactions: KPJ
Top