Skip to main content
Coding Quests

Coyote time

I pressed jump at the edge. Why did I fall?

  • Platformer feel
  • Beginner
  • 5 minutes
  • No account needed

You run for the edge and press jump right as you reach it. The character falls anyway. To the game, your feet left the ledge a frame or two earlier. To you, you were still standing on it.

Loading the lab...

No account needed. Nothing here is locked.

How it works

Coyote time is a second timer. While you stand on the ground, it stays full. The moment you step off, it starts counting down. Until it reaches zero, a jump press still counts. Players never notice it is there. They only notice when it is missing.

Too much of a good thing

Make it too long and players can jump from well out over a pit. That looks like a double jump, and it breaks levels built around exact gaps. Around 100 ms feels fair without feeling like a cheat.

The usual mistake

Not clearing the coyote timer when the jump fires. The timer is still running in mid-air, so a second press could jump again. Set it to zero the moment you jump.

Use it when: Any edge the player leaves on purpose. Ledges, the end of a moving platform, the top of a ladder and the lip of a wall slide all need it.

The code in Godot

A timer that stays full on the ground and drains in the air. Names and numbers match the free quest.

Show player.gd
player.gd
GDScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
extends CharacterBody2D
​
const JUMP_VELOCITY = -300.0
const COYOTE_TIME = 0.10 # grace to jump after walking off an edge, in seconds
​
var coyote_timer := 0.0
var gravity: float = ProjectSettings.get_setting("physics/2d/default_gravity")
​
func _physics_process(delta: float) -> void:
if not is_on_floor():
velocity.y += gravity * delta
​
# Full while standing. Counts down once your feet leave the ground.
if is_on_floor():
coyote_timer = COYOTE_TIME
else:
coyote_timer = max(coyote_timer - delta, 0.0)
​
# On the ground, or only just off it: the jump still counts.
if Input.is_action_just_pressed("jump") and coyote_timer > 0.0:
velocity.y = JUMP_VELOCITY
coyote_timer = 0.0 # no second jump from the same grace
​
move_and_slide()

The free quest pairs this timer with a jump buffer. Then a jump needs two things: a remembered press and recent ground.

Build it for real

A lab shows you the decision. A quest has you write the whole system, with every step checked as you go.

Try another lab

All labs

Questions

What is coyote time in games?

Coyote time is a short window after you run off a ledge where a jump still works. The player is already falling, but the game pretends they are still on the edge for a moment.

Why is it called coyote time?

After the cartoon coyote who runs off a cliff and hangs in the air before he falls. The game gives the player that same moment of hang time to jump.

How long should coyote time be?

About 0.1 seconds is a common start, which is 6 frames at 60 frames per second. Shorter feels strict. Much longer lets players jump from out over the gap.

How do I add coyote time in Godot 4?

Keep a coyote_timer. Set it full while is_on_floor() is true, and count it down with delta otherwise. Allow the jump while the timer is above zero, then set it back to zero.

What is the difference between coyote time and jump buffering?

Coyote time forgives a press that is too late, just after leaving a ledge. Jump buffering forgives a press that is too early, just before landing. They are separate timers, and most platformers use both.

The game above is a port of player.gd from the free quest A Jump That Feels Amazing, with the same numbers. It steps at 60 physics frames a second, like Godot. The runner holds right for you at the quest's 130 pixels a second. Art by Kenney, CC0.

Coyote Time in Godot 4: Feel It Before You Code It | Coding Quests