I need help with grid based movement!

So first off I just want to say that I’m new in the field of game development, and I’ve only been using Gdevelop for maybe less than a month. I’ve been trying to make a game with grid based movement and I only want my character to change directions when it’s at the center of a tile. I’ve tried multiple methods which have all failed and so far I only have basic movement. I was wondering if anybody here could help me solve this issue. I have a screenshot of most of the conditions as well. Help would be much appreciated!

1 Like

There are different ways of doing grid-based movement. I’ve done it one way, similar to yours, where you just change the x/y position to be one grid square larger or smaller. This gives the effect of the object ‘jumping’ between squares.

Another way I’ve just done it, is using the top-down movement behaviour (with large (1000+) acceleration/deceleration values) along with the pixel-perfect movement extension. This keeps movement aligned to the grid, and makes the movement smoother and less jumpy.

Instead of using a top down character controller, what if you just used tweens? You could have the charavter move when a key is pressed using a tween and then have it snap to a virtual grid to make sure it doesnt overshoot. Then when the tween is done, allow the player to press a key to move again.

You dont necessarily need anything too complicated since its not a free movement.

Sorry for the late reply, I’ve tried the pixel perfect top down movement before and the problem with it is that I can’t get a trigger once condition to work for it, as I want it to keep moving forward with a single click like PacMan or the Snake Game snake. Plus, in top down movement I can’t turn diagonals off, even if I uncheck allow diagonals.

You can try this extension: New extension: Grid Based Movement by github-actions[bot] · Pull Request #665 · GDevelopApp/GDevelop-extensions · GitHub