|
|
|
|
|
by Cthulhu_
355 days ago
|
|
One thing that helped me was doing some tutorials for pico-8, an intentionally 'weak' game platform, one of which is a platform game with a simple / understandable inertia / gravity simulation (jumping, running left/right; think Mario). It was understandable enough with an x / y position for the character and a delta-x / delta-y representing their current speed. Every frame the dx / dy would get changed depending on player input and/or character state. Ex: if player presses jump button, set state to 'jumping' and dy to 1. Every frame, dy = dy * 0.9. When dy <= 0, set state to 'falling'. Every frame, dy = dy * 1.1 until dy = 1 (terminal velocity). Then add some collision detection. I think those basics are also behind the simpler physics simulations, the 'falling sand' types would be ideal for an application like this. |
|