Jumping
From YoYoGames Wiki
// Jumping
if (jumping == 1) {
jumptime += 1;
if (jumptime <= 5) {vspeed = -17}
if (jumptime > 5) {
if (jumptime <= 10) {vspeed = -12}}
if (jumptime > 10) {
if (jumptime <= 15) {vspeed = -7}}
}
Provided there’s nothing underneath our man, increase his vspeed up until a certain maximum falling speed. When you press jump (and you’re standing on something) don’t simply momentarily set vspeed to a negative value but instead as long as that jump button is pressed have a timer increase, and set your vspeed accordingly. It’s very simple code but many GM games miss it. Different values for different times means you can still incorporate a decrease in upwards speed but not have it nearly as much as your usual gravity. Mak A little note about using “if…” within another “if…”, unless you have to use an “else” statement afterwards it’s much better than using “&&” because if the first statement is not true the computer doesn’t have to read anything else. It may seem small but over the whole code of your game it does make a sizable efficiency gain.
All credits goes to Alaric Holberton (Rikrok) and markUp magazine 14.

