Log inGet started
World

Lantern Depths: Find the Shade Dash, Slay the Thorn Knight

Branchmain
Branchesmain
Commitda5ac13948

README.md

safeGround2D: respawn on the last safe ground (2D platformer)

Hollow Knight style hazard respawn for twoDKit platformers: touch spikes or fall into a pit and you lose one life and come back on the last safe ground you stood on, a step from where you fell, instead of at the last checkpoint. Lives, the hit effect and the respawn itself are Trapline's; this package only decides where you come back. Multiplayer: each peer tracks only its own player, on a temporary entity of its own.

Install and use

  1. In the engine shell: zero zeromind installAsset 3352de30-21bf-4ff1-8b01-16720ec043e6. It brings twoDKit and Trapline with it.
  2. In a scene's build.luau:
local PP = require("twoDKit.api")

function content()
    PP.level({ text = [[
########################
#......................#
#......................#
#......................#
#......................#
#......................#
#......................#
#......................#
#..........====........#
#......................#
#.P.......^^^^.........#
########################
]] })
    PP.player({ character = "knight" })
    local e = entity.spawn("SafeGround")
    e.component.add(asset.resolve("safeGround2D.SafeGround2D", "component"), {})
end

Press Play and run into the spikes: you lose a life and land back where you last stood safely, just before them.

From code

require("safeGround2D.api"): track(body, state, now) (call each frame for this peer's player; returns true when it remembered a new spot), moveTo(x, y) (send the next respawn somewhere else, a bench for example), lastSafe(), footing(state), isSafeSpot(x, y, spikeAt?), configure({ interval, margin }), stop(). sideScrollerKit drives it this way and moves the spot to the player's save point when they lose their last mask.

Changelog

  • 1.0.2: one-line install with this package's id (it brings twoDKit itself). No code change.
  • 1.0.1: the kit that drives it is now called sideScrollerKit (README wording only).
  • 1.0.0: first release (split out of sideScrollerKit's respawn).