Hop across to a surface within a tile (floor, walls and ceilings) #5

Merged
SnekInAScarf merged 5 commits from floor-hop into main 2026-10-31 20:47:40 -05:00
Owner

Stacked on #4 (→ #3 → #2): this PR targets movement-feel. Merge #2, #3 and #4 first.

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 height: looks for a ceiling up to 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 plus HOP_OVERSHOOT (2px), so it still reaches the ceiling with a bit of speed and sticks.
  • No ceiling in reach: a small HOP_NO_CEILING_HEIGHT (16px) hop, so the input still feels like it did something.
  • Against a wall: up still climbs the wall, as before. No hop.
  • Letting go of up before 0.5s cancels it, and so does holding left or right (the 0.5s starts over once you stand still).
  • Landing on the ceiling plays the existing splat (sound and particles).

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:

  • Surface within one tile on that side: hop straight across and stick to it. Wall hops go at crawling speed on an arc that lands at the same height (no air steering mid-hop). Ceiling hops push down onto the floor below.
  • Nothing in reach: let go, as before.
  • Moving along the surface (climbing a wall, or left/right on a ceiling): nothing happens; you stay stuck. Like the floor hop, the 0.5s only counts while you're still, and starts over once you stop. This applies to letting go too, not just hopping.

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.

  • Tested 88 ledge drops (both directions, thick and one-tile platforms, many starting distances): all land on the wall. Without the fix, 44 failed (every right-ledge case).

Testing

Wall/ceiling hops: headless with boxes built in the test (independent of the level layout), 13/13 pass:

  • Walls one tile apart: hops across after 0.5s, landing within 1px of the same height, and back again.
  • Opposite wall 24px away: hops across. 44px away (out of reach): lets go.
  • Holding away while climbing: stays on the wall. Stop climbing (still holding away): hops 0.5s later.
  • Ceiling with the floor 12px below: hops down. Floor 44px below: lets go. Holding down while moving left/right (with or without a floor in reach): stays on the ceiling.
  • Floor hop onto a ceiling 12px above still works.

Floor hop:
Headless in Godot 4.7.2, in test_level.tscn. 9/9 pass:

  • Under the low overhang (12px above): hops on frame 30 (0.5s), rises exactly 12px, sticks to the ceiling and stays stuck.
  • Under the middle platform (44px above, out of reach of one tile): little hop, lands again.
  • Holding up while walking: no hop. Stopping while still holding up: hops 0.5s later.
  • Open space (nearest ceiling ~200px up): ~17px hop, lands back on the floor.
  • Releasing up after 20 frames: no hop.
  • Against the right wall: up climbs the wall instead.

The existing movement suite (39 tests) still passes.

Still needs a playtest for feel.

🤖 Generated with Claude Code

> **Stacked on #4** (→ #3 → #2): this PR targets `movement-feel`. Merge #2, #3 and #4 first. ## 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 height:** looks for a ceiling up to `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 plus `HOP_OVERSHOOT` (2px), so it still reaches the ceiling with a bit of speed and sticks. - **No ceiling in reach:** a small `HOP_NO_CEILING_HEIGHT` (16px) hop, so the input still feels like it did something. - **Against a wall:** up still climbs the wall, as before. No hop. - Letting go of up before 0.5s cancels it, and so does holding left or right (the 0.5s starts over once you stand still). - Landing on the ceiling plays the existing splat (sound and particles). 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: - **Surface within one tile on that side:** hop straight across and stick to it. Wall hops go at crawling speed on an arc that lands at the same height (no air steering mid-hop). Ceiling hops push down onto the floor below. - **Nothing in reach:** let go, as before. - **Moving along the surface** (climbing a wall, or left/right on a ceiling): nothing happens; you stay stuck. Like the floor hop, the 0.5s only counts while you're still, and starts over once you stop. This applies to letting go too, not just hopping. ### 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. - Tested 88 ledge drops (both directions, thick and one-tile platforms, many starting distances): all land on the wall. Without the fix, 44 failed (every right-ledge case). ## Testing **Wall/ceiling hops:** headless with boxes built in the test (independent of the level layout), **13/13 pass:** - [x] Walls one tile apart: hops across after 0.5s, landing within 1px of the same height, and back again. - [x] Opposite wall 24px away: hops across. 44px away (out of reach): lets go. - [x] Holding away while climbing: stays on the wall. Stop climbing (still holding away): hops 0.5s later. - [x] Ceiling with the floor 12px below: hops down. Floor 44px below: lets go. Holding down while moving left/right (with or without a floor in reach): stays on the ceiling. - [x] Floor hop onto a ceiling 12px above still works. **Floor hop:** Headless in Godot 4.7.2, in `test_level.tscn`. **9/9 pass:** - [x] Under the low overhang (12px above): hops on frame 30 (0.5s), rises exactly 12px, sticks to the ceiling and stays stuck. - [x] Under the middle platform (44px above, out of reach of one tile): little hop, lands again. - [x] Holding up while walking: no hop. Stopping while still holding up: hops 0.5s later. - [x] Open space (nearest ceiling ~200px up): ~17px hop, lands back on the floor. - [x] Releasing up after 20 frames: no hop. - [x] Against the right wall: up climbs the wall instead. The existing movement suite (39 tests) still passes. Still needs a playtest for feel. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
SnekInAScarf added 1 commit 2026-10-31 18:21:33 -05:00
Holding up on the floor for MAX_SECS_TO_UNSTICK hops just high enough to
reach a ceiling up to HOP_MAX_HEIGHT (64px) above the slime's top, where
it then sticks. With no ceiling in reach it does a little 16px hop.
Against a wall, up still climbs it instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf added 1 commit 2026-10-31 18:27:46 -05:00
- Holding left or right resets the hop timer, so the 0.5s hold only
  counts while standing still.
- HOP_MAX_HEIGHT is now 32 (one tile), as adjusted by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf added 1 commit 2026-10-31 19:16:50 -05:00
Holding away from a wall or ceiling for MAX_SECS_TO_UNSTICK, while not
moving along it, now hops straight across to a surface within
HOP_MAX_HEIGHT on that side and sticks to it. With nothing in reach (or
while moving along the surface) it lets go as before.

- Wall hops go at crawling speed on an arc that lands at the same height,
  with no air steering until they land.
- Ceiling hops push down onto the floor below.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf changed title from Hop up to the ceiling after holding up on the floor to Hop across to a surface within a tile (floor, walls and ceilings) 2026-10-31 19:16:50 -05:00
SnekInAScarf added 1 commit 2026-10-31 19:24:13 -05:00
When a wrap finishes, Godot still thinks we're on the floor we started
from. On the finishing move_and_slide it then snapped us down onto it
(floor_snap_length) and counted the wall we were pushed into as floor
(floor_block_on_wall), so we landed as "on floor", stuck to nothing,
and fell the next frame. It only happened on right-hand ledges because
of how the contact lined up. Turn both off for the finishing move unless
the wrap ends on a floor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf added 1 commit 2026-10-31 19:31:16 -05:00
Holding away from a wall while climbing, or down on a ceiling while
moving left/right, no longer counts towards MAX_SECS_TO_UNSTICK; the
timer starts over once you stop. Same rule as the floor hop, and it
covers both letting go and hopping across.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf changed target branch from movement-feel to main 2026-10-31 20:47:37 -05:00
SnekInAScarf merged commit 4eb50988ea into main 2026-10-31 20:47:40 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: SnekInAScarf/SlimePlatformer#5
No description provided.