- Home /
Enemy Movement AI in top-down, 2D, tile & turn based game
I'm just getting into AI for a game I've been working on and pathfinding is throwing me for a loop. It's a very basic Roguelike taking inspiration from Nethack. It is turn based, and on an entity's turn they can move 1 unity unit.
All I want right now if for the enemies to move closer to the player every turn (They need to move 1 unit towards them), but I don't know how to do this. Please help!
Comment
Answer by Nocktion · Nov 22, 2018 at 08:15 AM
Well you should get the players position and the enemys position and then you can calculate a direction out of it. And by transferring that direction to an int coordinate e.g.: (1, 0, 1), (-1, 0, 0)... You get where to move.