Count down number of moves as player-character makes movement from box to box. Please read details

Hello,

My player moves grid-to-grid horizontally and vertically and has only limited number of moves to get from start to finish.

I would like to display a move counter on screen which should decrease as the player-character moves on the grid. So ultimately, the game is over if the player can’t reach the finish with in the possible number of moves.

Just simply make an integer that goes down by 1 every time the function is called to move the player, and if it hits 0, then call a function to load the GAME OVER screen or something.