[SOLVED] Sprite still moving during separate objects in grid based movement

As the title says, I’ve a grid based top down movement character using the extension Grid Based Movement from GitHub (New extension: Grid Based Movement by github-actions[bot] · Pull Request #665 · GDevelopApp/GDevelop-extensions · GitHub).

A problem is when the character steps one tile, I’m able to change its facing position during this step pressing the other directions. The tile step is still performed though.

Another problem is I would like the character to perform an entire animation withing the tile step. Now, my character performs the animation in the way of an action character, mean it continues until I keep pressed and iit’s not “tile fit” (or “tile perfect”).

Again, when the character collides on another object using “separate objects”, it actually steps without moving from its position. In other words, if the character is facing a wall, moving towards the wall doesn’t make the character to change its position but it’s moving anyway; if I move it against the wall and then I move it in another direction, it doesn’t change direction until completed its step.

I’ve seen RapaGamez did it but I didn’t cath how Rapa has done it. Here Rapa game: Working Title Dedroid by RapaGamez

My Events:

I’ve found a solution for the first problem, the character changing position, in this topic: [SOLVED] Is it possible to prioritise the keys?

Now there’s still the problem of moving forward despite the separate objects collision. I’ve modified my previous comment and the title.

This seems complex. Maybe, it needs to be. Can you share a screenshot, gif or video of the gameplay so we can better understand what you’re doing? Maybe there’s an easier way which you haven’t learned yet.

This is an example. Mind that transparent squares are blocks with separate objects collision (in the second image above, is the last “action” without “condition”).

In the first gif below, the character moves in to the right after completed its step to the left. So far so good.


In the second gif, I made the character perform the same action but against the block, mean already facing the block and move toward to it. Character doesn’t move to the right immediately, look like it’s stuck, that’s because it’s performing the move to the left.
Notice I made the character two steps on the left: one to reach the block, an other followed by the step to the left to show the “stuck” effect.


My goal is don’t allow the character to step toward a block.

P.S.: sorry for the copyrighted characters, they aren’t intended to be part of a game but I’m using them as a base for this test.

In this thread: Problem with the collision system - #13 by GiAnMMV
The user Slash says: “Maybe don’t use collision and instead check position of player and terrain and don’t allow movement, if position is blocked.”

I didn’t figure how to let the character stop when collides with another object, keeping in account my events are based on variables and Position X/Y. Every time I try to stop the character on a block I obtain many other effects, mostly teleport in another position or block all the character movements. I’m still try, though, looking if raycast could help me.

Problem solved for wall checking. WendIgosoft’s video (Ground checking via ray cast | Patrolling character - Tutorial GDevelop 5 - YouTube) reminded me about raycast, and I used it in this way:

Was very simple but it took me a lot of time to realise.

This is the result:
grid based raycast wall walk

I’ll sign this topic as solved.

1 Like