Skip to content

Goal

A place to push a crate to, for Sokoban-style puzzles, with no code: it’s covered while a grid crate (a Pushable with a GridMovement) rests in its cell, and once every goal with the same AllCoveredMessage is covered, that message is sent: the puzzle solved. Put it on the floor under where the crates go; it needs no collider (a solid one would block them). A Counter counting its Goals Covered shows how many are covered.

Part of the Puzzles module: Grid puzzles, Sokoban style: goals for crates (Goal), undo and restart (MoveHistory), the Puzzle template, and Create Goal in the Entity menu.

A crate that starts on a goal covers it from the start, without its sound or messages. Only a crate that has finished gliding into the cell covers it.

Works with: Pushable (grid crates that cover it); Counter (counting its Goals Covered shows how many are covered)

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.

  • accepts: text = null. The kinds of crate that cover it (each a pushable’s Kind), separated by commas, e.g. “Red, Blue”. Empty takes any crate. (Names crate kinds: their names, separated by commas.) (Field: a name.)
  • coveredTint: a color, “#RRGGBB” or “#RRGGBBAA” = “#9CE08AFF”. The color a crate turns while it rests on it, so the player sees it’s in place. Transparent leaves crates alone. (Field: a color.)
  • sound: text = null. A sound played when a crate covers it, e.g. “Sounds/click.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
  • coverMessage: text = null. A message sent with Game.Send when a crate covers it, with this entity as its data. (Names a message.) (Field: a name.)
  • uncoverMessage: text = null. A message sent with Game.Send when its crate is pushed off it, with this entity as its data. (Names a message.) (Field: a name.)
  • allCoveredMessage: text = null. A message sent once every goal with this same All Covered Message is covered, with this entity as its data: every crate home, the level solved. It’s sent again if they’re all covered again after one is uncovered. (Names a message.) (Field: a name.)

What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.

  • Covered (true or false). True while a crate it accepts rests on it.
  • GoalsCovered (a whole number, out of its goals). How many goals in the scene are covered, this one too: all of them once every crate is home.
  • Goals (a whole number). How many goals the scene has.

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

  • coveredBy: an entity: its name, id or path. The crate resting on it, or null.
  • isCovered: true or false. True while a crate it accepts rests on it.
  • goalsCovered: a whole number. How many goals in the scene are covered, this one too: all of them once every crate is home.
  • goals: a whole number. How many goals the scene has.

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