Harbour Jump is a small Godot 4 level where a pixel-art knight jumps the gap between two piers, with a 49-frame jump that Ludo's Transfer Motion traced from a 3.9 second clip of a real person. It is the project from the Ludo.ai video on rotoscoping, the technique behind Prince of Persia's jump, and the code here does the two things a game still has to do with such a sheet: give each frame the real person's timing, and move the knight across the gap the way the person moved.
Show full description...
What's inside:
- main.tscn and main.gd: the level. The harbour, one collision box per pier, the knight, the on-screen labels and the reference clip, which plays in the top-right corner at its real speed.
- knight.gd: the knight. Idle, jump, fall and splash; root motion over the air frames, from the travel measured on the clip; a landing check (no pier under his feet and he drops into the water); and a planted boot that stays put while he crouches and lands.
- jump_timing.gd: builds the SpriteFrames, either with the sheet's own even timing or with one duration per frame from the retime keys. The frames themselves are never changed.
- data/: the retime keys, the travel measured on the clip and where the planted boot sits in every frame.
- art/: the knight's 49-frame jump sheet, his idle loop and the harbour background, made with Ludo.ai (Image Generator, Transfer Motion, Sprite Generator Animate).
- ref/: the reference clip as frames, for the corner picture.
- tools/: measure_travel.py and measure_feet.py, to measure your own clip and sheet (Python 3 with Pillow and NumPy; the travel script also needs ffmpeg).
- tests/smoke_test.gd: checks that run without a window.
Open project.godot in Godot 4.7 or later and press Play. The window is portrait. Controls: Space (or A on a gamepad) jumps the gap, T (or the on-screen button) switches between the sheet's own timing and the reference timing, M turns the travel on and off, Left and Right shuffle along the pier, R resets.
Jump once with each timing and watch the clip in the corner: with the sheet's timing the knight leaves the ground while the person is still crouching, then floats; with the reference timing the two take off and land together. Take off from the far left end of the pier and he lands short, in the water.
Checks without a window: godot --headless --path . -- test=1 jumps with both timings and from too far back, and prints SMOKE TEST: PASS.
The prompts and settings for every asset, and the steps to do it with your own clip, are in README.md in the zip.
Code: MIT. Art: CC BY 4.0, credit "Harbour Jump by Ludo.ai (https://ludo.ai)".
Motion source: "Forward Jump Animation Reference | Athletic Male" by Endless Reference, https://www.youtube.com/watch?v=R6-1Ls82hmQ, licensed CC BY 3.0. Cropped to the side view, traced by Ludo Transfer Motion into the knight's jump and used as the motion reference; slowed and sped up frame by frame by the reference timing here. ref/reference_jump.png is the cropped clip as frames, and knight_jump.png is an adaptation of it, so keep this credit with either.
Make your own: ludo.ai
Source on GitHub: github.com/Ludo-AI/ludo-godot-samples