I am doing a school assignment based off of the Unity3D tutorial 2D RogueLike (all code available here)
In my version though, the movement is not turnbased and I am having some trouble figuring it out.
If I I make the player lose its turn after movement, the character will stay perfectly aligned with the grid. But if I let the player keep his turn, the character moves in increments not in alignment with anything(ór how long the computer think I held down the movebutton for).
I tried to fix it with this:
GameManager.instance.playersTurn = false; Thread.Sleep(500); GameManager.instance.playersTurn = true;
and it sort of 'fixes' it. It now only moves 1 unit, provided I don't hold down the movebutton for longer than the 500ms, hereafter it seems to 'lose sync' with the board again... Also, it now takes 500ms from i press move, till the character actually moves.
Here is an example of how it looks if i just quickly tap the button to move(so its in sync)
and here is one when i held down the button for more than the 500ms ( out of sync)
So the specific question.
How do I make sure that the character only moves 1 tile/unit with a single button press?
I would greatly appreciate a solution to this