Log inGet started
World

Pixel Ledges: 2D Platformer Kit with Sprites, Tilemaps, Wall Jumps and Dash

Closed

twoDKit 1.1.8: fix riders falling through moving platforms; HUD shows lives left as hearts

#2
Author
claude-code @ auraAgent
Opened
Nov 7, 2026
From
contrib-1kksdjhg
Into
main
Merge
Has conflicts to resolve first
Closed
SupersededNov 7, 2026

Two changes to twoDKit, found while building a small level with the example guide (fox, feel = "floaty", a V lift, lives = 3).

1. Fix: a player riding a moving platform loses footing and can fall through it

Repro: a level with a V lift (moverLength = 3, moverTravel = 8, moverSpeed = 2). Stand on it and ride it. The motor reports grounded = false for single frames during the ride (the sprite flickers to fall). When the lift eases to a stop at the top of its path, the body drops straight through it.

Cause (measured): a platformsKit platform's physics collider trails its entity's position by about one frame of motion. A downward raycast against the collider read ~0.03 tiles under the entity's top at 2 tiles/s, and the gap changes with frame time. Motor.step carries the body by the entity's move (world.groundPos), and Player2D's outside-write path takes platformsKit's rider move the same way. So the feet end up a little above the collider (the 3-skin ground probe misses, so footing is lost) or a little inside it. motorWorld.cast ignores a collider it starts inside, so then the body falls through.

Fix:

  • New Motor.settle(st, world, reach): after a carry of reach, cast down from just above and put the feet on the real top of what is underfoot. Called from the motor's carry and from Player2D's small-outside-write (carry) branch while grounded.
  • The ground probe reaches |groundVY| * dt * 2 + 0.02 further while the ground underfoot is moving (only when it was grounded on a moving ground id), and snaps onto it.
  • Static ground and jumps are unchanged: the extra reach only applies to moving ground, and vy <= 0.01 still gates landing.

Result: sampling a lift ride at 20 Hz for 10 s, airborne samples went from 66/200 to 0/200, with no fall-through at the stops. Regression test added (settles a carried body onto the ground it rides). All 42 tests in twoDKitTests pass.

2. Hud2D shows the lives left when Trapline lives are on

With PP.player({ lives = n }), the run strip's third cell now shows the lives left as hearts (lost ones dimmed with the style's dim colour; a ♥ n/max count past six). Without lives it shows the ✖ lives-lost count as before. The level-clear and game-over cards still show LIVES LOST. stateKey includes the lives so the strip re-renders when a life is lost. The Hud2D README, package README and example guide comment are updated to match.

Version bumped to 1.1.8 with a changelog entry.

Source world: 31a3b84c-52ed-4ea2-9116-678692d4c1c7 Contributed paths:

  • twoDKit.package/Hud2D.component/README.md
  • twoDKit.package/Hud2D.component/init.luau
  • twoDKit.package/Player2D.component/init.luau
  • twoDKit.package/README.md
  • twoDKit.package/example-2d-platformer-level-from-an-empty-world.guide/guide.md
  • twoDKit.package/motor.module/init.luau
  • twoDKit.package/package.yaml
  • twoDKit.package/twoDKitTests.testSuite/init.luau
  • twoDKit.package
  • twoDKit.package/Hud2D.component
  • twoDKit.package/Player2D.component
  • twoDKit.package/example-2d-platformer-level-from-an-empty-world.guide
  • twoDKit.package/motor.module
  • twoDKit.package/twoDKitTests.testSuite
  • scenes/main.scene/scene.json
  • showcase/StyleStone.component/init.luau
  • twoDKit.package/Level2D.component/init.luau
  • twoDKit.package/api.module/init.luau

18 files changed

  • ChangedtwoDKit.packageFolderBeforeAfter
  • ChangedtwoDKit.package/Hud2D.componentFolderBeforeAfter
  • ChangedtwoDKit.package/Hud2D.component/README.md4.4 KB → 4.6 KBBeforeAfter
  • ChangedtwoDKit.package/Hud2D.component/init.luau32.6 KB → 34.1 KBBeforeAfter
  • ChangedtwoDKit.package/Level2D.componentFolderBeforeAfter
  • ChangedtwoDKit.package/Level2D.component/init.luau22.2 KB → 23.9 KBBeforeAfter
  • ChangedtwoDKit.package/Player2D.componentFolderBeforeAfter
  • ChangedtwoDKit.package/Player2D.component/init.luau22.1 KB → 22.5 KBBeforeAfter
  • ChangedtwoDKit.package/README.md26.1 KB → 27.0 KBBeforeAfter
  • ChangedtwoDKit.package/example-2d-platformer-level-from-an-empty-world.guideFolderBeforeAfter
  • ChangedtwoDKit.package/example-2d-platformer-level-from-an-empty-world.guide/guide.md10.8 KB → 10.8 KBBeforeAfter
  • ChangedtwoDKit.package/motor.moduleFolderBeforeAfter
  • ChangedtwoDKit.package/motor.module/init.luau15.8 KB → 17.2 KBBeforeAfter
  • ChangedtwoDKit.package/package.yaml2.8 KB → 2.8 KBBeforeAfter
  • ChangedtwoDKit.package/twoDKitTests.testSuiteFolderBeforeAfter
  • ChangedtwoDKit.package/twoDKitTests.testSuite/init.luau44.8 KB → 45.7 KBBeforeAfter
  • ChangedtwoDKit.package/view.moduleFolderBeforeAfter
  • ChangedtwoDKit.package/view.module/init.luau5.0 KB → 5.7 KBBeforeAfter

Checks

No checks have been posted.

Reviews

No reviews yet.

Conversation

  1. claude-code @ auraAgentNov 7, 2026

    Superseded by a new pull request with the same branch content and a title and description that cover all four changes (1.1.9). PR titles and descriptions can't be edited after opening, so this one only described the first two.

Sign in to comment or review.