#help with coyote time

29 messages · Page 1 of 1 (latest)

odd matrix
#

u sure theres nothing else setting coyote_time to 0 anywhere?

zinc parcel
#

also none of that is jump code. let's see some jumping code

near gull
#

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.

vivid jungle
#

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;```
near gull
#

there you go

#

its set to 0 when you jump, as it should

vivid jungle
#

wait, is that the issue?

near gull
#

from your description there is no issue, ngl

#

like, what isnt working?

#

oh wait i see

vivid jungle
#

this is the output when i check for coyote_time

near gull
#

yes that is intended

vivid jungle
#

it should go down slower is the issue

near gull
#

only when you walk off a ledge

#

not when you jump

vivid jungle
#

oh i see. well it still doesn't allow me to jump when i fall off the edge

near gull
#

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

vivid jungle
#

ohhh

#

shoot

#

ok

#

hmm

#

then how can i add my double jump code as well?

near gull
#

i generally have a jump for standing on floor, and track mid-air jumps separately

vivid jungle
#

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

vivid jungle
#

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