Hop across to a surface within a tile (floor, walls and ceilings) #5
Loading…
Reference in a new issue
No description provided.
Delete branch "floor-hop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this does
Hold up on the floor, while not moving left/right, for
MAX_SECS_TO_UNSTICK(0.5s) and the slime does a little hop, just high enough to reach the ceiling above it, and sticks there.HOP_MAX_HEIGHT(32px, one tile) above the slime's top, by testing the slime's shape straight up. If it finds one, it hops exactly that high plusHOP_OVERSHOOT(2px), so it still reaches the ceiling with a bit of speed and sticks.HOP_NO_CEILING_HEIGHT(16px) hop, so the input still feels like it did something.All three values are constants at the top of
player.gd.Walls and ceilings
The same idea works on walls and ceilings, using the direction away from the surface (away from a wall, down on a ceiling) for
MAX_SECS_TO_UNSTICK, while not moving along it:Fix: falling off the wall right after dropping off a right-hand ledge
Holding down + right off a ledge sometimes let go of the wall straight away. When a wrap finished, Godot still thought the slime was on the floor it started from, so the finishing
move_and_slide()snapped it down (floor_snap_length, added in #4) and counted the wall as floor (floor_block_on_wall). The slime landed as "on floor", was stuck to nothing, and fell. Both are now off for that one move unless the wrap ends on a floor.Testing
Wall/ceiling hops: headless with boxes built in the test (independent of the level layout), 13/13 pass:
Floor hop:
Headless in Godot 4.7.2, in
test_level.tscn. 9/9 pass:The existing movement suite (39 tests) still passes.
Still needs a playtest for feel.
🤖 Generated with Claude Code
Hop up to the ceiling after holding up on the floorto Hop across to a surface within a tile (floor, walls and ceilings)