Implementation method for grid movement

I want the player character to move in a grid-like manner, but I’m struggling to implement it effectively.

Based on the image above, I initially tried removing the interference from MoveAndJumpSettings and implemented movement using “Specify Movement Direction” in Visual Studio. While the character now moves in increments matching the grid size, it ends up moving continuously when the input is held down.

(At first, I tried adjusting movement parameters using MoveAndJumpSettings, but it didn’t work out…)

I also reduced the collision box size slightly to prevent sticking, but the character still seems to clip into walls, which feels unnatural.

If there’s a more elegant implementation method, I would appreciate your guidance.

48gridmove.zip (48.3 KB)

With the cooperation of Zounomori-san, we have created a sample. How does this look?

2 Likes

Great sample, and I was able to notice the types of shapes for CollisionShape2D!

Thank you!

2 Likes