#help with coyote time
29 messages · Page 1 of 1 (latest)
also none of that is jump code. let's see some jumping code
None of this is setting your coyote_time variable to 0 instantly.
If you are getting this from some tutorial, your jump function may actually just set your coyote time to 0 whenever you jump - if it didn't, you would be able to jump again mid-air repeatedly until the coyote time ran out. Coyote time is only meant to allow you to jump mid-air when you walk off a ledge to make the timing more forgiving, not multiple times off the floor.
this is my jump code:
function yMovement()
{
yspd += grav;
// Cap falling speed
if (yspd > term_vel) yspd = term_vel;
// Reset jumps
if (place_meeting(x, y + 1, oWall))
{
current_jumps = 0;
}
// Count falling as a jump
else if (current_jumps == 0) current_jumps = 1;
}
function jump()
{
if (jump_key_pressed && current_jumps < max_jumps && coyote_time > 0)
{
coyote_time = 0;
yspd = jspd;
current_jumps++;
}
}```
// Create
// Jumping
grav = 0.275;
term_vel = 4;
jspd = -5.25;
current_jumps = 0;
max_jumps = 1;
coyote_time = 0;
coyote_time_max = 3 * 60;```
wait, is that the issue?
this is the output when i check for coyote_time
yes that is intended
it should go down slower is the issue
oh i see. well it still doesn't allow me to jump when i fall off the edge
coyote time isn't the issue, you are setting current jumps to 1 when you are falling, and you are not allowing a jump when current jumps are 1
i generally have a jump for standing on floor, and track mid-air jumps separately
so i should keep my current jump functions and track the air jumps differently?
that's what i was trying to do with current_jumps
but i guess i could just have a normal jump function then an air jump and have the max jumps at 1
this is what i came up with, but it is not working as intended
function jump()
{
if (jump_key_pressed and onGround() and coyote_time > 0)
{
coyote_time = 0;
yspd = jspd;
}
}
function airJump()
{
if (jump_key_pressed and !onGround() and current_jumps < max_jumps)
{
yspd = jspd;
current_jumps++;
}
}```
the coyote time is not being considered at all when the player walks off the edge a bit