Jumping Mechanic
I've been working on a platforming engine in JavaScript. Collisions and Physics are all calculated from scratch and lately I've been having issue with jumping. Normally, this would be fine for me, but this is the first time I've used my own form of collision detection and physics, (which engines such as unity will make simple for you) and this changes things up. So, I would like to know how you guys would implement a nice jumping mechanic (that also includes a groundcheck if you can!) The only variables you would need to know are y (player's y coordinate), gravity (force of gravity), and a spacebar variable that tracks whether or not the spacebar is being pressed. My overall physics function is being called once per frame with the engine test map running at 60 FPS. TL;DR I would like to see examples of jump code for a 2D platformer that uses standard gravity and y variables that triggers on space press. edit: I don't need physical code if you aren't too familiar with js. Describing in detail the recommended process will work fine as well!