Character going into walls

I’m making a very simple 4-directional game as my first attempt and my character keeps walking into the walls and getting stuck. I used collision detection and it works for walking into walls from the left, though there’s a jarring frame of her bouncing backwards, but she gets stuck when approaching from any other direction. I should also note I’m having her move in grid increments.

Please could someone help?

Many thanks.

Hey @fredburma - post a link to your game so we can check it out :slight_smile:

https://flowlab.io/game/view/838316

Thanks.

@grazer I don’t know what timezone you’re in or how quickly you can reply to individual posts so this is a friendly nudge

Hes in eastern. Were both in eastern

@grazer @CrimsonBlackGames either of you able to follow up on this for me please? Or can you point me to someone who can? Thank you.

Are you using a position by chance? Or is one of the objects not solid?

Check and see

If its a position, replace it with a Velocity, or a motor

Hey @fredburma - the issue is that you are moving the character and then checking for collisions, which results in the jarring behavior you are seeing.

There are a few ways to fix this, but the simplest is probably to use the new RayCast behavior to check for a collision before moving. I’ll try to work up a quick example and post it.

@fredburma - here’s an example of grid-based movement with collision detection, and the logic is super simple: http://flowlab.io/game/view/843549

That’s amazing, thank you so much @grazer and @CrimsonBlackGames

Keep up the good work guys.