Skip to content

Crumble

A platform that gives way, with no code: once something on its Layers stands on it, it shakes for Delay seconds and falls away, coming back Respawn seconds later. Needs a collider.

Requires: Collider

Changes how its entity is drawn (a tint, a shake or drawing it on top).

Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.

  • delay: a number = 0.5. Seconds it shakes, once stood on, before it falls away. (Field: a number.)
  • respawn: a number = 3. Seconds until it comes back. 0 never comes back. (Field: a number.)
  • layers: text = “Player”. The collision layers that set it off by standing on it, e.g. “Player”. Empty is any body. (Names collision layers: their names, separated by commas.) (Field: a name.)
  • sound: text = null. A sound played as it falls away, e.g. “Sounds/crumble.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
  • effect: text = null. A prefab spawned where it was as it falls away, e.g. a burst of “Rubble”. (Names a prefab.) (Field: a name.)
  • crumbled: true or false = false. True while it’s gone (its entity is hidden). Saved, so it stays gone when the game rewinds. (Field: on or off.)

Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.

  • isShaking: true or false. True while it’s shaking, about to go.
  • shakeOffset: [x, y]. How far it’s shaken off its place right now; it’s drawn there, while its collider stays put.

Scripts use it as Crumble: its methods, events and values that aren’t saved with the scene.