Grid Basement Movement 2D

Whats a good way to force a character on grid based movement? I have a 12 x 12 grid made up of tiles, and I only want a character to walk from the center of a tile to the center of another tile. Horizontal and Vertical movement only, no diagonal.

Lerp from one point to another; e.g. if the character is on a tile at location 10, 7 and moves right, then lerp from 10, 7 to 11, 7. Here’s a grid move script, and here’s an example of it in action (more or less; it’s modified somewhat but the idea is the same).

–Eric

1 Like