Right now, if the player reaches the edge of the map, trying to move beyand the edge it will move it one tile over the edge , then it will bring it back, triggering a new move, new redraw and new calculation of energy.
The validation of the movement should be done before the movement, not after.
[ ] Move the player at keypress after you validate the move, not before
Right now, if the player reaches the edge of the map, trying to move beyand the edge it will move it one tile over the edge , then it will bring it back, triggering a new move, new redraw and new calculation of energy.
The validation of the movement should be done before the movement, not after.