Handling slopes 2d platformer - sliding down

I’ve been modifying this tutorial to expand it to include more features such as camera positioning (moves a little ahead of you as you move!). Made some of the geometry slopes, and noticed this when not moving.

How would you do it? I’m inexperienced with coding physics, even box2d.


I’d like to eventually make an editor with Defold that can replicate some of the features from this tool, and then build levels based on the saved data from that too.

1 Like

What happens is that gravity pulls the frog down, then after collision the frog is move out of the ground - the shortest path. That means that it moves up-left a little. Then gravity pulls it down next frame etc etc.

There are many ways to proceed depending on the nature of your game. One simple way is to calculate vertical collision separation only.

3 Likes