thx! it worked, but when I press it repeatedly, it jumps up and up continuousRight now, you're telling the engine that for as long as the key is detected, execute that code.
What you need to is check a keypress. The fact a key as pressed and not the fact its "on or off".
The function you need to use is "keyboard_check_pressed()"
You will need to add a jump state / flag to the if condition so it can check if the object has not jump then it executes the nested codes. The jump state resets when it hits the ground.thx! it worked, but when I press it repeatedly, it jumps up and up continuous
//create event
isjump = false;
//step event
//Do the floor check first before the key press check
if (place_meeting(x,y+1, obj_floor) && isjump == true) {
isjump = false;
}
if (keyboard_check_pressed(vk_space) && isjump == false) {
//jump codes here
isjump = true;
}
thx!!! It workedYou will need to add a jump state / flag to the if condition so it can check if the object has not jump then it executes the nested codes. The jump state resets when it hits the ground.
e.g. code
Code://create event isjump = false;
Code://step event //Do the floor check first before the key press check if (place_meeting(x,y+1, obj_floor) && isjump == true) { isjump = false; } if (keyboard_check_pressed(vk_space) && isjump == false) { //jump codes here isjump = true; }