How should I implement grid based movement

I was wondering how I would implement movement within a game like the old digger game, by this I mean I want the player to only be able to move in squares when pressed. I would know how to implement everything else though just the movement I’m not too sure on how would be best.


check out this Learning Templates [Blueprint Power] - Community Content, Tools and Tutorials - Unreal Engine Forums , i used grid based movement in Sokoban / PacMan / Snake Templates

Brilliant thank you I’m looking at the Sokoban one right now and think I understand, the main movement is through a lerp between the start position and a new set end position with a line trace in front of the player to see if they can move or not.

I dont however understand where this math is for the line trace. I understand that this value from the select is then times by one hundred later on to make it the end location.

Why would it need to add this end location to the start though i dont understand either?

When i press a key to move ,
1- it checks the direction based on what is press

2-the direction is stored

3- Trace test is made , if it’s free:

4- player location is stored

5- Time line is played

(Player Stored location + Direction * Grid Size)

okay yes I understand thank you for your help.