Walking through walls/solid objects

On many occasions we have issues with our solid character being able to walk through walls and solid objects.

Please post a link to the game and explain further.

Is it possible that the objects in question have had their “is solid” check box unset? If they are configured to be solid, but other solid objects still pass through them, then that does indeed sound like a problem. If you can post a game link, that would be helpful in tracking it down.

This has walking through walls. https://flowlab.io/game/play/734471

Hey @mefronius - now that I see the game the issue is much clearer :slight_smile:

So here’s the root of the problem: The x or y position is being set directly, 5 pixels at a time. When you are adjacent to a wall and try to move, the movement logic will force the player inside the block by 5 pixels. When you release the keys, the physics engine will resolve the collision and move the player back out, but this looks weird.

The good new is that this is a pretty easy fix, just let the physics engine handle the movement, and it will handle the collision checking and prevent the player from entering other objects. Here’s how:

  1. Remove the Position block, and instead send your Number outputs into a Velocity block. This will start the player moving, but he will not penetrate any walls.

  2. At this point, you’ll have a new problem - namely that the player will keep moving when you release the movement keys instead. To fix that, send the “up” output of your Keyboard triggers into a Number set to “0”, and send that value into the Velocity. This will set the player’s velocity back to 0 when releasing a key.

Here’s what that looks like:

rpg_movement

Let me know if you have any questions, and I hope this helps.

P.S. It looks like your Flip logic isn’t quite right either, but I didn’t address that - let me know if you have problems with that.

Thank you. We will work on this ASAP.

like the game so far bro