+ 2

# Gravity for side scrolling game - Mario like clone

I'm trying to code for gravity in python with pygame to create a Mario clone...I think the values for x has to be placed in a quadratic formula to solve for y that changes with the speed of movement, so when stationary, x won't change. I'll have to have some sort of loop because if x is 0, y can't change, right? I'm so list right now. If there's an easier way to do this, let me knos.

1 Answer

+ 5

Here is a nice tutorial in processing about applying an ascending force to an object.
You can apply the same concepts to your python script.
https://m.youtube.com/watch?list=PLRqwX-V7Uu6bb7z2IJaTlzwzIg_5yvL4i¶ms=OAFIAVgD&v=XwfOVFelLoo&mode=NORMAL
Another set of tutorials in processing using vectors to apply forces to an object.
https://m.youtube.com/playlist?list=PLRqwX-V7Uu6ZwSmtE13iJBcoI-r4y7iEc