Log inGet started
World

PYRAMID — Tower Defense

Branchmain
Branchesmain
Commit82c25f40b2

README.md

EnemyDirector

The night. One instance lives on the scene's GameDirector entity, attached by scenes/main.scene/entrypoint.luau at play start.

  • Registers itself as pyramid.state.director, which is what makes State.requestWave() (the HUD's SEND WAVE) reach :sendWave().
  • Reads rules.WAVES: every group's delay, count and gap become a sorted schedule of bodies, each spawned as a temporary entity carrying the Enemy component, spread across three lanes on the 3 m road.
  • Advances State.time (the clock the slows are measured against) every frame, and drives the phase: build → wave, then +4 stone and back to build when the wave is cleared, or won after wave 8. lost is reached through State.shatter and State.spend in pyramid/state, not from here.
  • Owns the transient dust: a kill event puffs ochre sand at the body, a leak throws limestone and turquoise faience off the seal. Motes are spawned temporary and pooled, so a running night never writes them into the scene.
  • Clears the road if the run is reset (State.wave falls back to 0).

Emits wave and wave_cleared with { wave = n } alongside the state module's own stone / phase / shatter events, for the HUD and the sound pass.

Needs pyramid.rules and pyramid.state, and the Enemy component (the bodies it spawns). Nothing else in the slice depends on its internals: the shared surface is State.