Moving Platforms
A moving platform travels back and forth along a path, waits at each end, and carries whoever stands on it. Move the platform first, then move the rider by the exact distance it moved, keep its feet on the top, and let a jump or step off keep the platform's speed.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Moving Platforms" to my game.
What it should do: A platform that travels on its own and takes the player along. It makes the player time jumps against a moving target, and it turns a gap or a shaft into a ride.
Build it exactly as this state machine. First check that it fits my game, then build it like this:
```mermaid
stateDiagram-v2
[*] --> carried
ground: On the floor
air: In the air
carried: Carried along
resting: On stopped platform
ground --> air: jumps or falls
air --> ground: lands on floor
air --> carried: lands, platform moving
air --> resting: lands, platform stopped
carried --> resting: platform stops
resting --> carried: platform sets off
carried --> air: jumps or steps off
resting --> air: jumps or steps off
```
Use these starting values:
- platformSpeed: 3 units/s
- pauseTime: 0.8 s
- travelX: 6 units
- travelY: 2 units
- halfWidth: 1.5 units
- walkSpeed: 4 units/s
- jumpSpeed: 12 units/s
- inheritScale: 1
- gravity: 32 units/s²
- maxFallSpeed: 20 units/s
Watch out for these common mistakes:
- Carried by speed instead of distance: Tell your AI: move the platform first, then move the rider by exactly the distance the platform just moved.
- A platform that drops faster than gravity: Tell your AI: while the rider stands on the platform, put its feet on the top every tick instead of letting gravity pull it.
- A jump that forgets the platform: Tell your AI: when the rider leaves the platform, give it the platform's speed on top of its own push.
- A platform that rises into a falling rider: Tell your AI: judge the landing against where the top was and where it is now, not against the old top alone.
- Time lost at the turn: Tell your AI: when a tick reaches an end, spend the time left on the wait and then on the way back.
- Landing from below: Tell your AI: catch only a rider whose feet were at or above the top before the tick.
Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
What it does
A platform that travels on its own and takes the player along. It makes the player time jumps against a moving target, and it turns a gap or a shaft into a ride.
How it runs, as a diagram
Everything it can be in, and what moves it on. Your AI builds from exactly this.
How it runs, as a diagram
- On the floor → In the air: jumps or falls
- In the air → On the floor: lands on floor
- In the air → Carried along: lands, platform moving
- In the air → On stopped platform: lands, platform stopped
- Carried along → On stopped platform: platform stops
- On stopped platform → Carried along: platform sets off
- Carried along → In the air: jumps or steps off
- On stopped platform → In the air: jumps or steps off
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| platformSpeed | 3 units/s | How fast the platform travels. Slow enough that a player can step on and off, fast enough that waiting for it is not boring. |
| pauseTime | 0.8 s | How long it waits at each end. The wait is where the player gets on and off safely. Zero makes a platform that never lets go. |
| travelX | 6 units | How far the path goes across. Zero with a height makes a lift. |
| travelY | 2 units | How far the path goes up. Negative goes down. Zero with a width makes a flat ride. Keep the whole path above the solid floor, or a rider stepping off at the bottom lands on the floor at once. |
| halfWidth | 1.5 units | Half the width of the platform. It decides how far the rider can walk before stepping off. |
| walkSpeed | 4 units/s | How fast the rider walks on the platform and steers in the air. |
| jumpSpeed | 12 units/s | How hard the rider pushes off, counted from the platform, not from the world. |
| inheritScale | 1 | How much of the platform's speed a jump or a step off keeps. One is how the real world works. Zero makes jumps feel stuck to the spot, and a rider on a fast platform lands behind it. |
| gravity | 32 units/s² | How fast a rise slows down. |
| maxFallSpeed | 20 units/s | The fastest the rider can fall. |
What usually goes wrong
Carried by speed instead of distance
If the rider is moved by the platform's speed before the platform has moved, or after it, it is one tick behind. It slowly slides back, or jitters when the platform turns.
Fix: Tell your AI: move the platform first, then move the rider by exactly the distance the platform just moved.
A platform that drops faster than gravity
A rider that only falls with gravity is left floating above a platform that sinks faster, then bangs back down onto it. It looks like the platform shakes.
Fix: Tell your AI: while the rider stands on the platform, put its feet on the top every tick instead of letting gravity pull it.
A jump that forgets the platform
A jump counted from the world's standstill drops the rider behind a platform that moves sideways, and a jump from a rising platform comes out weak. Jumping off a falling platform comes out strong.
Fix: Tell your AI: when the rider leaves the platform, give it the platform's speed on top of its own push.
A platform that rises into a falling rider
A rider falling just above a platform that rises quickly can end the tick below the top and be missed, because the check only looked at the rider's move and the old top.
Fix: Tell your AI: judge the landing against where the top was and where it is now, not against the old top alone.
Time lost at the turn
A tick that reaches the end of the path and just stops there loses the rest of its time. Slow frames then make the platform slower overall, and two machines drift apart.
Fix: Tell your AI: when a tick reaches an end, spend the time left on the wait and then on the way back.
Landing from below
A rider jumping up from under the platform gets pulled onto it, because after the move the feet are at or below the top and the check forgot to ask where they were before.
Fix: Tell your AI: catch only a rider whose feet were at or above the top before the tick.
How to check it works
- Your character stands on a platform that moves sideways. The platform travels for two seconds: The character keeps exactly the same place on it, with no sliding.
- Your character stands on a platform that travels up and down along its path. The platform runs for 20 seconds: The character's feet are on the top every single tick.
- Your character stands on a platform that sinks fast. The platform sinks for most of a second: The character stays on it and never hovers.
- Your character stands on a moving platform. Walk across it for one tick: The character moves by its walking distance on the platform, on top of being carried.
- Your character stands on a platform moving sideways. Jump: The character leaves with the platform's sideways speed and keeps going its way.
- Your character stands on a rising platform. Jump: The jump is the platform's speed stronger than from the floor.
- The share of platform speed kept is set to zero. Jump from a platform that moves sideways: The character has no sideways speed from it.
- Your character walks to the edge of a moving platform. It steps off the side: The character leaves with the platform's speed.
- Your character falls onto a moving platform. It lands and the platform keeps moving: The character is carried along without sliding.
- Your character falls just above a platform that rises quickly. The platform rises past where the character would be: The character lands on it.
- Your character is under a rising platform, moving up. The platform reaches it: The character is not caught.
- A platform runs its path back and forth. It reaches an end: It stands still for the wait time before it goes back.
- A platform runs its path back and forth. It runs for a minute: It reaches the far end exactly and never goes beyond either end.
Works well with
- One-Way Platforms: Most moving platforms are open from below, so the same catch rule applies, judged in the platform's own frame. Move the platform first, then check the catch.
- Coyote Time: A late jump just after stepping off a moving platform should still work. Keep the platform's speed for it. Count the platform as ground the same as a ledge.
- Dash: A dash on a moving platform should go the way the player pushed, not the way the platform moves. Add the platform's speed on top.
Clashes with Jump Buffering: A remembered jump fires on landing. On a moving platform the landing and the jump happen in one tick, and the jump must still pick up the platform's speed. Run the landing first, then the remembered jump, in that order, and carry on from the platform's new place.
Common questions
how do i make a moving platform that carries the player
Paste this: Add a moving platform: move the platform first, then move the player who stands on it by exactly the distance the platform moved, and put its feet on the top. A jump or a step off keeps the platform's speed.
why does my player slide off a moving platform
The player is moved before or after the platform, so it is a tick behind. Move the platform first, then move the player by the distance the platform just moved.
why does my player shake on a moving platform going down
Gravity pulls the player slower than the platform sinks, so it hovers and then bangs down. While the player stands on the platform, put its feet on the top every tick.
should a jump from a moving platform keep its speed
Yes, in most games. The player already moves with the platform, so leaving it at a standstill feels like being thrown backward. A setting between none and all lets you tune it.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 18 tests pass on the reference code.
- The state diagram was checked against the code, at the default values and at every listed low and high value.
Your AI gets the code
Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it