I am trying to make a small game much like "Shopping Cart Hero".

In the same way, the player gains speed by going down a slope and then jumps. However I can't figure out how to make the player go down the slope.

Right now I am simply making him move to the right, adjusting its ._y to make it stick to the ground. That would be ok if the slope was flat, as going 5 pixels to the right and 0 down = a speed of 5, BUT going 5 pixels to the right AND adjusting lets say 4 pixels down = a speed of about 6.4

So I was wondering what would be the right way to do this.

Also the slope will not be fixed, there will be changes like height and angle.



Thx a lot !