Turn based tactics AI movement

Hi all, I'm trying to make a TBT type of a game. I made the player attack and move. On enemies however, I'm stucked.

Here is my logic for player movement:

  • If the move is clicked, the player will spawn "movement blocks" on 4 directions.
  • If the movement block is clicked, it will save the block's location in an attribute (goto X, goto Y)
  • The player goes to goto X, goto Y

This is not applicable to the AI since you won't click a movement block. I just make him move 1 or 2 blocks to the player. Each block is 64 pixels so its basically move to 64* random(1,2) or 64* random(-2,-1) if on the other side.

The problem is, the enemy overlaps with the player, sometimes while overlapping, the enemy shakes violently then moves away. This usually leaves the enemy out of the grid. If I used collide, it either pushes the player or not moving at all

Any help or insight is appreciated. Thank you

Sign In or Register to comment.