Grid based npc movement

I was able to get the player character movement for a traditional rougelike but now I’m trying to figure out doing the same for a walking mob, specifically one chasing down the player character

That’s how I learned player movement

I’m going to make the assumption that roguelike movement means like a snap to grid style movement?

If that’s the case you might want to attach the pathfinding behavior to your mobs. What you will find useful is setting the virtual grid to the size of the grid in your game, setting speed and acceleration to zero (you will handle movement externally) and the expressions




You wont use this to move your player, but to calculate a route. The action ‘move to’ with the player position will create nodes in the behavior that have positions in their index (position 0 should be your current position, position 1 will have the node to the next position etc).

And then you can use the positions from the GetNodeX and Y expressions to move your mob 1 grid space closer to your target that will account for walls and other obstacles you set up.