Smoother movement feel, plus landing/wrap sounds and splat particles #4

Merged
SnekInAScarf merged 5 commits from movement-feel into main 2026-10-31 20:47:34 -05:00
Owner

Stacked on #3 (which is stacked on #2): this PR targets floor-edge-drop. Merge #2 and #3 first.

What this does

Makes the existing movement feel smoother. No new abilities.

Movement

  • Acceleration: full speed in 4 frames, stopped in 6, on floors, ceilings and walls (GROUND_ACCEL, GROUND_FRICTION). Turning around brakes first, then accelerates.
  • Air momentum: leaving a surface keeps your speed. Steering in the air is gentler (AIR_ACCEL), and extra speed above AIR_SPEED fades slowly (AIR_DRAG) instead of snapping from 150 to 75.
  • Fall speed cap: MAX_FALL_SPEED = 400.
  • Edge wraps ease in and out: a wrap starts at the speed you were already going (so a floor-edge drop from standing still speeds up over 4 frames), and you leave it still moving along the new surface, then slow to a stop normally.
  • Surface snap: if the slime drifts up to 4px off a wall or ceiling it's sticking to, it's pulled back instead of falling. Only head-on hits count, so walking off an edge doesn't snap you back around its corner. Letting go of a wall on purpose still works. floor_snap_length matches.

Holding at edges

  • Moving along a floor, ceiling, or down a wall towards its edge now stops at the edge, and only carries on over it after holding towards it for MAX_SECS_TO_UNSTICK (0.5s). Before, only ceilings had a hold (the lip), so walking off a floor sideways or crawling off the bottom of a wall dropped instantly.
  • Letting go of the direction during the hold keeps you there. Pressing into the surface during the hold still swings around the edge.
  • Climbing up past a wall top still swings over onto it straight away (no hold).
  • Tile seams and the foot of a wall don't count as edges: a corner only counts if there's empty space just past it, behind the surface. (The level is a TileMapLayer made of separate shapes, and the edge ray could hit the inside face of a neighbouring tile.)
  • After swinging onto a ceiling, a held down doesn't count towards letting go until it's released, like walls already did.

Edge sensor range

  • edgeSensorRange halved from 24 to 12: pressing into a surface only wraps around its edge when the slime is touching the edge (center within 12px, about a 1px gap), instead of up to 13px away. Walking up to an edge still always works, since the hold stops you there.
  • Measured with a headless sweep on floors, ceilings and wall bottoms:
Range Center within Gap to edge
24 (old) 23px 13px
16 15px 5px
14 13px 3px
12 11px ~1px
10 9px overhanging 1px
8 7px overhanging 3px
  • Fixed: the sensors could hit the player's own collider (they're under the EdgeSensors pivot, so exclude_parent didn't cover the player). With a range equal to the slime's radius (10), edge wraps never triggered.

On screen

  • Physics interpolation turned on (physics/common/physics_interpolation), so movement looks smooth on monitors above 60Hz.
  • Pixel snapping (rendering/2d/snap/snap_2d_transforms_to_pixel) to stop the 32px sprite shimmering at fractional positions.
  • Sprite rotation moved into _physics_process, so interpolation smooths it too, and it now uses 1 - exp(-k * delta), so it turns at the same rate at any frame rate.
  • Sprite offset: checked. The (0, -6) offset rotates with the sprite, so its bottom lines up with the collider on every surface. No change needed.

Sounds and particles

  • Landing: a random squish (slightly random pitch) and a burst of slime-green pixel particles at the contact point when you land on any surface faster than MIN_LAND_SPEED. Walking along a surface doesn't trigger it.
  • Edge wraps: a quiet bubble sound.
  • Sounds are on the SFX bus, so the existing volume slider controls them. The landing sounds are an exported landSounds array on the Player, so you can swap them in the Inspector.
  • Placeholder sounds are CC0 from OpenGameArt: "40 CC0 water / splash / slime SFX" by rubberduck. See Assets/Sounds/CREDITS.txt. The particles are plain pixels, so no art was needed.

Testing

Headless in Godot 4.7.2 with a script that builds platforms, spawns the player and simulates input. 39/39 pass:

  • All edge-wrap cases from #3 (floors, ceilings, walls, inside corner, lip, wall top, chained).
  • Floor speed per frame: 37.5 → 75 → 112.5 → 150; stop: 125 → … → 0 on frame 6. Wall climb matches.
  • Walking off an edge keeps ~135 speed, then eases to 75; falling caps at exactly 400.
  • 1px gap under a ceiling and 3px gap from a wall both still stick; holding away from a wall still lets go.
  • Floor-edge drop wrap speed ramps 0 → 150, exits at 150, then stops on the wall.
  • Landing splats (sound + particles); walking doesn't.
  • Edge holds on floor (both directions), ceiling, and both wall bottoms: stop at the edge, hold ~30 frames, then drop.
  • Releasing mid-hold stays put; into-surface during a hold wraps (floor, ceiling, wall bottom → ceiling underneath, still holding down).
  • Holding down on a ceiling normally still lets go.
  • test_level.tscn loads and runs.
  • In test_level.tscn: walking the floor both ways, up to the raised block and the side walls, and climbing ~120px up the tall right wall (across several tile seams) and back down cause no holds; walking off the top of the raised block holds at its edge and then drops.

Note: when quitting a headless run, Godot 4.7.2 reports a "leaked" audio playback for any AudioStreamPlayer that has played and is still in the scene. I reproduced this with a bare player and a single sound, so it's an engine quirk at exit, not a project problem.

Still needs a playtest. Headless tests can't judge feel or how it sounds.

🤖 Generated with Claude Code

> **Stacked on #3** (which is stacked on #2): this PR targets `floor-edge-drop`. Merge #2 and #3 first. ## What this does Makes the existing movement feel smoother. No new abilities. ### Movement - **Acceleration:** full speed in **4 frames**, stopped in **6**, on floors, ceilings and walls (`GROUND_ACCEL`, `GROUND_FRICTION`). Turning around brakes first, then accelerates. - **Air momentum:** leaving a surface keeps your speed. Steering in the air is gentler (`AIR_ACCEL`), and extra speed above `AIR_SPEED` fades slowly (`AIR_DRAG`) instead of snapping from 150 to 75. - **Fall speed cap:** `MAX_FALL_SPEED = 400`. - **Edge wraps ease in and out:** a wrap starts at the speed you were already going (so a floor-edge drop from standing still speeds up over 4 frames), and you leave it still moving along the new surface, then slow to a stop normally. - **Surface snap:** if the slime drifts up to 4px off a wall or ceiling it's sticking to, it's pulled back instead of falling. Only head-on hits count, so walking off an edge doesn't snap you back around its corner. Letting go of a wall on purpose still works. `floor_snap_length` matches. ### Holding at edges - Moving along a **floor, ceiling, or down a wall** towards its edge now stops at the edge, and only carries on over it after holding towards it for `MAX_SECS_TO_UNSTICK` (0.5s). Before, only ceilings had a hold (the lip), so walking off a floor sideways or crawling off the bottom of a wall dropped instantly. - Letting go of the direction during the hold keeps you there. Pressing into the surface during the hold still swings around the edge. - Climbing up past a wall top still swings over onto it straight away (no hold). - Tile seams and the foot of a wall don't count as edges: a corner only counts if there's empty space just past it, behind the surface. (The level is a `TileMapLayer` made of separate shapes, and the edge ray could hit the inside face of a neighbouring tile.) - After swinging onto a ceiling, a held down doesn't count towards letting go until it's released, like walls already did. ### Edge sensor range - `edgeSensorRange` halved from 24 to **12**: pressing into a surface only wraps around its edge when the slime is touching the edge (center within 12px, about a 1px gap), instead of up to 13px away. Walking up to an edge still always works, since the hold stops you there. - Measured with a headless sweep on floors, ceilings and wall bottoms: | Range | Center within | Gap to edge | |---|---|---| | 24 (old) | 23px | 13px | | 16 | 15px | 5px | | 14 | 13px | 3px | | **12** | **11px** | **~1px** | | 10 | 9px | overhanging 1px | | 8 | 7px | overhanging 3px | - Fixed: the sensors could hit the player's own collider (they're under the `EdgeSensors` pivot, so `exclude_parent` didn't cover the player). With a range equal to the slime's radius (10), edge wraps never triggered. ### On screen - **Physics interpolation** turned on (`physics/common/physics_interpolation`), so movement looks smooth on monitors above 60Hz. - **Pixel snapping** (`rendering/2d/snap/snap_2d_transforms_to_pixel`) to stop the 32px sprite shimmering at fractional positions. - **Sprite rotation** moved into `_physics_process`, so interpolation smooths it too, and it now uses `1 - exp(-k * delta)`, so it turns at the same rate at any frame rate. - **Sprite offset:** checked. The `(0, -6)` offset rotates with the sprite, so its bottom lines up with the collider on every surface. No change needed. ### Sounds and particles - **Landing:** a random squish (slightly random pitch) and a burst of slime-green pixel particles at the contact point when you land on any surface faster than `MIN_LAND_SPEED`. Walking along a surface doesn't trigger it. - **Edge wraps:** a quiet bubble sound. - Sounds are on the **SFX** bus, so the existing volume slider controls them. The landing sounds are an exported `landSounds` array on the Player, so you can swap them in the Inspector. - Placeholder sounds are CC0 from OpenGameArt: ["40 CC0 water / splash / slime SFX" by rubberduck](https://opengameart.org/content/40-cc0-water-splash-slime-sfx). See `Assets/Sounds/CREDITS.txt`. The particles are plain pixels, so no art was needed. ## Testing Headless in Godot 4.7.2 with a script that builds platforms, spawns the player and simulates input. **39/39 pass:** - [x] All edge-wrap cases from #3 (floors, ceilings, walls, inside corner, lip, wall top, chained). - [x] Floor speed per frame: 37.5 → 75 → 112.5 → **150**; stop: 125 → … → **0** on frame 6. Wall climb matches. - [x] Walking off an edge keeps ~135 speed, then eases to 75; falling caps at exactly 400. - [x] 1px gap under a ceiling and 3px gap from a wall both still stick; holding away from a wall still lets go. - [x] Floor-edge drop wrap speed ramps 0 → 150, exits at 150, then stops on the wall. - [x] Landing splats (sound + particles); walking doesn't. - [x] Edge holds on floor (both directions), ceiling, and both wall bottoms: stop at the edge, hold ~30 frames, then drop. - [x] Releasing mid-hold stays put; into-surface during a hold wraps (floor, ceiling, wall bottom → ceiling underneath, still holding down). - [x] Holding down on a ceiling normally still lets go. - [x] `test_level.tscn` loads and runs. - [x] In `test_level.tscn`: walking the floor both ways, up to the raised block and the side walls, and climbing ~120px up the tall right wall (across several tile seams) and back down cause no holds; walking off the top of the raised block holds at its edge and then drops. Note: when quitting a headless run, Godot 4.7.2 reports a "leaked" audio playback for any `AudioStreamPlayer` that has played and is still in the scene. I reproduced this with a bare player and a single sound, so it's an engine quirk at exit, not a project problem. Still needs a playtest. Headless tests can't judge feel or how it sounds. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
SnekInAScarf added 1 commit 2026-10-31 15:38:15 -05:00
- Accelerate to full speed in 4 frames and stop in 6, on floors, walls
  and ceilings, instead of snapping.
- Keep momentum when leaving a surface; air steering is gentler and
  extra speed fades slowly. Fall speed capped at 400.
- Edge wraps ease in from a standstill and carry their speed out onto the
  new surface.
- Pull back onto a wall/ceiling that's drifted up to 4px away instead of
  falling off (floor_snap_length matches).
- Physics interpolation and pixel-snapped 2D transforms. Sprite rotation
  moved into _physics_process and made frame-rate independent.
- Squish sound + slime particles on landing, bubble sound on wraps.
  Placeholder CC0 sounds by rubberduck from OpenGameArt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf added 1 commit 2026-10-31 17:02:35 -05:00
Moving along a floor, ceiling or down a wall towards its edge now stops
at the edge, and only carries on over it after holding towards it for
MAX_SECS_TO_UNSTICK. Before, only ceilings had this (the lip, which
started after leaving), so walking off a floor sideways or crawling off
the bottom of a wall dropped instantly. Climbing up past a wall top
still swings over onto it straight away.

- While holding at an edge, pressing into the surface still wraps
  around it.
- After wrapping onto a ceiling, a held down doesn't count towards
  letting go until it's released (like walls already did).
- Pull the corner finding out of _try_edge_wrap into _find_edge_corner.
- project.godot: settings re-sorted by the editor, no change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf added 1 commit 2026-10-31 17:14:10 -05:00
The level's TileMapLayer is made of separate collision shapes, and the
ray that looks for the side of a platform could hit the inside face of
a neighbouring tile. That made walking along the floor stop and "hold"
at tile seams and next to walls. A corner now only counts as an edge if
there's empty space just past it, behind the surface.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf added 2 commits 2026-10-31 17:54:36 -05:00
Since the sensors moved under the EdgeSensors pivot, exclude_parent
excludes the pivot rather than the player. With edgeSensorRange equal to
the slime's radius the rays start on the edge of its circle and hit it,
so edge wraps never triggered. Add the player as an exception.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pressing into a surface now only wraps around its edge when the slime's
center is within 12px of it, i.e. the slime is touching the edge (about
1px gap), instead of up to 13px away with the old 24. Walking up to an
edge still always works, since the edge hold stops the slime there.

Measured with a headless sweep of 24/16/14/12/10/8/6/4 on floors,
ceilings and wall bottoms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SnekInAScarf changed target branch from floor-edge-drop to main 2026-10-31 20:47:32 -05:00
SnekInAScarf merged commit 809c308a09 into main 2026-10-31 20:47:34 -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#4
No description provided.