L
Littlesticks
Guest
I have a jump code currently that works okay except with a few glaring and important issues. The first issue is that I can continuously spam the jump button to "jump" again and if I do it fast enough I can stay in the air. Another issue I spotted is that the player object might fall much faster than expected when I spam the jump a lot. So apparently it's stacking the values?
I've been trying to fix it for a few hours and I'm not sure what I'm doing wrong.
Please help (and teach me) what my mistakes are, ty
I've been trying to fix it for a few hours and I'm not sure what I'm doing wrong.
Code:
if (!place_meeting(x,y+1,obj_floor)){
y += jump_grav;
jump_grav += 1.5;
}
if (jump_grav > jump_grav_cap){
jump_grav = 8;
}
if (jump){
y -= jump_speed;
if (jump_grav = 8) {
jump_speed -= 1.5;
}
else {
jump_speed = 16;
}
}
if place_meeting(x,y+1,obj_floor){
jump_grav = 1.5;
jump_speed = 16;
}