Hi guys, I have been trying to make a tile movement style game, and I'm trying to make the enemy move to the player. In this case I'm using field of view to check for the player and then every time the player moves, the enemy moves to the Player.gridmovement.GridX and Player.gridmovement.GridY. Also, I have a condition for when the player stop moving, also does the enemy. That makes the enemy move to where I want in reaction to each step of the player, but it does so in diagonal.
Is there a way to make the enemy lock to moving only horizontal and vertical?
I tried to maybe check for the distance from the player in the X grid or in the Y grid and the taking the action to move in X or Y based on that, but up to this moment I've failed