A one-way platform is solid from above and empty from below: you jump up through it, and drop down through it on purpose. A moving platform carries you, and when you jump off it you keep its speed.
| Value | |
|---|---|
| Drop-through window | 0.22 s |
| Fast platform | 267 px/s |
| Running jump off it | 340 + 267 = 607 px/s |
| Gap that speed clears | 8 tiles (a full running jump covers 6.4) |
One-way platforms: up through, down on purpose
One-way platforms let the player climb a tower without walking around every floor. Dropping through takes down + jump, never down alone: down alone is crouch, and crouching on a one-way platform shouldn't drop you. Celeste's code calls them jump-thrus.
You're in control from the first frame. The steps are below.
- Jump up through the three platforms on the left with Space. You pass through from below and land on top.
- From the top one, jump right onto the pillar with → and Space, then walk off its far side onto the first platform of the shaft.
- Hold ↓ and press Space to drop through it. Do it once more to reach the floor and the way out at the bottom right.
- Now stand still on a platform and press ↓ alone. You only crouch: dropping takes both keys.
On a phone you get on-screen buttons: ← → to move, JUMP, and T for the technique.
The real game, running in your browser. The first load fetches the engine; after that it is cached.
Moving platform momentum: jump off with its speed
While you stand on a moving platform, it carries you and you don't slide. Jump, and you keep its speed on top of your own: run along a platform doing 267 px/s and you leave at 607 px/s, enough for an 8-tile gap that a 6.4-tile running jump can't clear. Keep its sideways and upward motion but drop the downward part, so jumping off a platform on its way down never shortens the jump.
How to implement one-way and moving platforms
- One-way: collide only from above, with some margin (6 px on an 8 px platform) so fast falls don't slip through, and put these platforms on their own collision layer.
- Drop-through: on down + jump over a one-way floor, stop colliding with that layer for 0.22 s and nudge the player 2 px down. Clear the jump buffer and coyote time too, or the same press jumps you straight back up.
- Moving platforms: move them in the physics step, the same step as the player, and carry whoever stands on them.
- Bleed extra speed slowly in the air. If air control pulls you back to run speed at the usual rate, the inherited speed is gone in about 0.1 s and the jump falls short.
The code in Godot 4
func _ready() -> void:
collision_layer = 2
# ...
shape.one_way_collision = true
shape.one_way_collision_margin = 6.0 func _drop_through() -> void:
_jump_buffer = 0.0
_coyote = 0.0
_drop_timer = 0.22
set_collision_mask_value(LAYER_ONE_WAY, false)
global_position.y += 2.0
velocity.y = maxf(velocity.y, 80.0)
# ...
func _apply_lab() -> void:
# INERCIA DE PLATAFORMA: al saltar desde una plataforma móvil se hereda su
# velocidad (sólo la componente ascendente en vertical: nunca acorta el salto).
platform_on_leave = (PLATFORM_ON_LEAVE_ADD_UPWARD_VELOCITY if Lab.on(&"platform_momentum")
else PLATFORM_ON_LEAVE_DO_NOTHING)
# ...
if absf(velocity.x) > p.max_speed:
# Sobrevelocidad (plataforma, dash-jump): perderla despacio, sobre todo en el aire.
rate = p.overspeed_decel if on_floor else p.air_overspeed_decel The platform is an AnimatableBody2D, so move_and_slide() carries the rider, and air_overspeed_decel is 140 px/s², slow enough for the inherited speed to last the whole jump.
Quick answers
Why does my jump off a moving platform fall short?
Check your air control first: speed above the run speed should bleed off slowly in the air (140 px/s² here, against about 2,473 for normal air acceleration). Then run with the platform. Jump standing still and you leave at 267 px/s, under your own run speed, so it's an ordinary jump.
Which platform_on_leave should I use in Godot?
PLATFORM_ON_LEAVE_ADD_UPWARD_VELOCITY. It keeps the sideways momentum and ignores downward motion, so a jump never comes out shorter. The default, PLATFORM_ON_LEAVE_ADD_VELOCITY, adds the downward part too.
Discussion
Comments are hosted on GitHub Discussions — sign in with GitHub to reply.