(Solved) Top Down Movement with Grid

Is it possible to use “Snap to Grid” with Top Down Movement? For me the object just smoothly slides.

If the object slides, it means there is no snap to grid enabled. You can look at the snap to grid example, but it uses the mouse I think.
Can you explain briefly what game/mechanic you’re trying to make? I’m not sure snap to grid is the best option.

In the end I’m trying to have player movable tiles that stop moving upon collision. To be able to rearrange said tiles.

Do you want them to snap or to stop on collision? That’s two different things…

Anyway, if my memory serves me right, once you figure out how to enable snap to grid, your tiles will not move anymore. Then you need to increase force until they can sort of override the snap and jump to the next slot.

But I think it would be nicer to simply change object position (Left pressed - remove 64 px on X axis, for instance). You could use tweens for nice visual effects.

I was hoping for both in the same game. My original idea was to make a sliding puzzle sometimes known as the 15- puzzle (also called Gem Puzzle , Boss Puzzle , Game of Fifteen, Mystic Square and many others.It consists of a frame of numbered square tiles in random order with one tile missing. You move the squares to put the numbers in order.

I’ve seen this game made with Gdevelop, but it used the mouse, not keyboard.
It used empty tiles and puzzle tiles on top. When a puzzle tile is clicked, it gets moved to the adjacent empty tile (a variable is used to check if it is empty or not).
It’s not using grid or topdown, just moving to the position of the empty tile.

Thanks I’ll try doing it along those lines. Thanks for the advice!

I am a newbie, not sure if I can help. But hopefully it shall open some more discussion.
I have been working on a similar task.

I stumbled upon using extensions. Found an extension which snaps objects to virtual grid.
So I added it as an action in the events manager and specified the object which was required to be snapped. here I also specified the gridsize (64x64).

Then , I added a TopDownMovement behavior to the same object.
Then in the events manager I added events such as on left key press subtract 64 (pixels).
Moving tiles should work on the basis of the same idea.

Thanks GMP, I’ll look into that!

Well I took advice from both Gruk and GMPanda. I,ve made something that works. See https://drive.google.com/file/d/15Tq2XXHNXDCbrSh6c1evE08lQ2yg0r8A/view?usp=sharing
for Zipped template, it’s very easy but shows how it works.
Thanks to both of you!

1 Like