Roguelike Enemy Movement

Hello all, I have browsed posts like this. But I have a hard time understanding them.
I am working on a top down game, the player moves one grid cell at a time(64*64). I have player movement working fine, but I would like an “Enemy” object to move on cell at a time towards the player. So far the “Enemy” continues moving.

Hope to hear from you, thank you in advance

What do you mean with this? The enemy moves but never stops? It moves in one direction, but not another? It moves smoothly, not in block steps? It moves in block steps, not smoothly?

How do you expect the enemy to move?

If you can explain the issue in more detail then we can get an idea of what the problem is. And if you provide a screen shot of your player and enemy movement events, it will help resolve the issue more quickly.

Sorry for the lack of information.

The enemy has pathfinding to avoid obstacles, it moves in horizontal and vertical lines toward the player, which is what I want.
And I configured it so it only moves towards the player after “Up, down, left, right” are pressed.
What I would like is that it only moves one grid cell at a time.

Thanks for the reply, attached are the events I have so far.

you could store the position of your pathfinding object, before you start moving it, and deactivate the pathfinding behavior, when distance of object to stored position is >= 64 and correct its position after that to make sure it stays inside your grid.

the way i handle it in spirit battle is, i use the node.X/Y of the pathfinding and substract 1 movement from the movement variable of the monster, when they reach a node and deactivate the pathfinding behavior when Movement reaches 0 and then correct the position.

Thanks for the reply, do you have a simple example of how you would implement it in the events?

am afraid, no, not a simple one.
but its only more complicated, because the movement varies between the monsters and depends on terrain.

it also heavily depends on how you determine the position, your enemy is supposed to go. if you use the position of the player as the destination of your pathfinding object, you can work with the nodes.
for just 1 grid per move, it could look as easy as this:


then you only need to determine the condition, to when your enemy is supposed to move, and then activate the pathfinding behavior again.
the position correction after you deactivate the behavior is important, because they usually never end up in the exact position.