Platformer Collisions (Solved)

I think I know how to solve this.
Thank you for all your help.

1 Like

I thought it had fixed it but it hasn’t so here is the problem. When my character touches the bottom of a platform he stays there for about a second and doesn’t fall to the ground. If in this time the player moves left or right the player wont fall to the ground until the user lets go. I think this is to do with the ground_contact being for the whole tile and not just the top of the tile. Is there a way to make the flag only one side of the object?

You can use the message.normal to figure out in which direction you are colliding with something. A message.normal.x that is non-zero indicates wall contact. Positive message.normal.y is ground and negative is ceiling (or vice-versa, I can’t remember!).

That makes sense thank you.

My code is the same as in the example yet my player still gets stuck.

But the unmodified example works?

The example works and when i have put it into my code it works but not exactly the same

Ok, so it’s not the same then :wink:

What about the collision shapes? That could make a difference? Boxes vs spheres for instance.

Yeah it isn’t but i cant find what. :joy:

The collision shapes for my game are a box for the body and legs and a circle for the head compared to 2 circles for the example.

Turns out I was applying gravity at the end of the update function instead of at the start. This has now fixed my issue.

2 Likes