Character

Jumping

Queues deterministic jumps with optional coyote time and input buffering.

jump() does not immediately modify position. It queues a request that the high-level fixed-step pre-pass dispatches before the native character update.

Basic jump#

GML
if (keyboard_check_pressed(vk_space)) {
    player.jump();
}

jolt_update();

if (player.just_jumped()) {
    audio_play_sound(snd_jump, 0, false);
}

Jump velocity#

GML
player.set_jump_speed(7);
var jump_speed = player.get_jump_speed();

A successful jump adds jump_speed along the controller's current up vector. The value must be finite and non-negative.

Coyote time and jump buffer#

GML
player.set_coyote_time(0.10);
player.set_jump_buffer(0.12);

var coyote_left = player.get_coyote_remaining();
var buffer_left = player.get_jump_buffer_remaining();
  • Coyote time allows a forced jump shortly after leaving supported ground.
  • Jump buffering retains a request made shortly before landing.
  • Both timers are measured and consumed by fixed physics steps.
  • A value of 0 disables the corresponding allowance.
GML
player.just_landed()
player.just_left_ground()
player.is_grounded()
player.is_in_air()

These transient flags make animation and sound changes independent of how many fixed steps were required for the current render frame.

Configuration versus countdown#

APIContract
get_coyote_time() / get_jump_buffer()Configured grace/buffer durations in seconds.
get_coyote_remaining() / get_jump_buffer_remaining()Current remaining time, not the configured maximum.
GML
show_debug_message(player.get_coyote_time());
show_debug_message(player.get_coyote_remaining());

Verified operation contracts#

These contracts distinguish units, return values, errors and lifetime according to the current implementation. Check results: false, 0 and undefined can mean different things for different methods.

Symbol / ownerSignatureOperation contract
JoltCharacter.get_coyote_remainingJoltCharacter.get_coyote_remaining()Stored limit or remaining time in seconds according to the name; getter does not check liveness. Timers advance in the fixed step; Grip/attachment cancel pending jumps.
JoltCharacter.get_coyote_timeJoltCharacter.get_coyote_time()Stored limit or remaining time in seconds according to the name; getter does not check liveness. Timers advance in the fixed step; Grip/attachment cancel pending jumps.
JoltCharacter.get_jump_bufferJoltCharacter.get_jump_buffer()Stored limit or remaining time in seconds according to the name; getter does not check liveness. Timers advance in the fixed step; Grip/attachment cancel pending jumps.
JoltCharacter.get_jump_buffer_remainingJoltCharacter.get_jump_buffer_remaining()Stored limit or remaining time in seconds according to the name; getter does not check liveness. Timers advance in the fixed step; Grip/attachment cancel pending jumps.
JoltCharacter.get_jump_speedJoltCharacter.get_jump_speed()Jump speed: current numeric value in m/s. Failure: undefined; an invalid object is not a zero measurement.
JoltCharacter.jumpJoltCharacter.jump()Boolean request acceptance, not confirmation of a performed jump. Processed before a physics step; buffer lasts at least one fixed timestep. Grip/attachment reject jumping. Use just_jumped for execution.
JoltCharacter.just_jumpedJoltCharacter.just_jumped()Boolean event for the managed frame; read after jolt_update. The next managed frame begin clears it. Not persistent state (e.g. just_landed is not is_grounded).
JoltCharacter.set_coyote_timeJoltCharacter.set_coyote_time(seconds)Seconds ≥0, default 0; Boolean. Shortens a running timer to the new maximum. Wrapper checks only negativity, so supply a finite number yourself; rejection of NaN/Infinity is not guaranteed.
JoltCharacter.set_jump_bufferJoltCharacter.set_jump_buffer(seconds)Seconds ≥0, default 0; Boolean. Shortens a running timer to the new maximum. Wrapper checks only negativity, so supply a finite number yourself; rejection of NaN/Infinity is not guaranteed.
JoltCharacter.set_jump_speedJoltCharacter.set_jump_speed(value)Jump speed: finite number ≥0 m/s; default 7. Returns true on acceptance, false for an invalid input or object. Updates the live object.