How to implement jumping with SDL2?


Hi guys I was wondering how to implement jumping in a 2D game.

Something like this but bit more accurate.

I mean jumping on the left, jumping on the right, and just jumping without moving on the x axis

I guess it will have something to do with gravity and probably something else I’m not aware of, being new in game development with C++ and SDL2.

Please let me know and many thanks in advance!

How to scroll smoothly from background1.png to background2.png by resetting player position to x0,y0 when in background2 and so on?

SDL will only help you out with the drawing/rendering. Google for something like “2d game physics” and you’ll have more than enough to get going.