Skip to content

Panel

A menu that opens over the game and closes again: a pause menu, an options panel, a shop, a map. It’s open while its entity is showing; while it is, the mouse, keyboard and gamepad only reach controls on it (not the HUD or a panel underneath, except buttons marked Button.OverPanels), its top control is picked straight away, and Esc or the gamepad’s B closes it. The press that opens or closes it is used up: the game’s scripts don’t see it that frame. Closing it gives the keyboard back to whatever was picked before. Open one with a ButtonAction.OpenPanel button, with OpenOn (a pause menu opens on “Pause”), with OpenMessage (a puzzle’s “Solved” screen), or from scripts with Game.OpenPanel (or by showing its entity).

Panels are hidden when the game starts unless Open is ticked, so they can be laid out in the Scene view.

In a network game, each machine keeps its own entity with this on it: it isn’t sent.

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.

  • open: true or false = false. Whether it’s open. Tick it to have the panel open when the scene starts; while the game runs it follows the panel, so rewinding puts it back as it was. (Field: on or off.)
  • pauseGame: true or false = true. Stop the game while it’s open: game time stands still and only scripts on open panels run. Untick it for a panel that the game goes on behind, like a game over screen during a slow-motion death. (Field: on or off.)
  • pauses: text = null. What it stops while it’s open: empty stops the whole game; an entity’s name (one inside this panel first) stops only it and everything inside it, as a PauseGroup does, while the rest of the game runs on behind the panel: the minigame a pause menu is for, the world behind a shop while the music and the HUD go on. (Only used when pauseGame is on.) (Names an entity.) (Field: an entity’s name.)
  • openOn: text = null. An input action that opens it when no other panel is open, and closes it again: “Pause” for a pause menu (Esc, P or Start), or one of your own, like “Map”. It waits while a script or system claims Back (Esc and B) for something under way, like a tool in hand. Empty opens it only from a button or a script. (Names an input action.) (Field: a name.)
  • openMessage: text = null. A message that opens it, with no code: “Solved” (a puzzle’s goals all covered), “GameOver”, or anything a pickup, switch or script sends. Empty opens it only from a button, its OpenOn action or a script. (Names a message.) (Field: a name.)
  • needsFlag: text = null. A flag that has to be set before it opens, e.g. “FoundMap” (set by a trigger’s Set Flag, a dialogue’s “[set FoundMap]” or a script’s Game.SetFlag), or “not FoundMap” for while it isn’t: until then its OpenOn action, OpenMessage and buttons that open it do nothing. Its Open action and scripts still open it. (Names a flag: “Name” holds while it’s set, “not Name” while it isn’t.) (Field: a name.)
  • closeOnBack: true or false = true. Whether Esc and the gamepad’s B close it. If it has a button whose Shortcut is Esc, they click that instead; while a running script claims Back (a builder’s tool in hand), they’re the script’s. Untick it for a panel the player has to choose their way out of. (Field: on or off.)
  • popup: true or false = false. Whether it’s a pop-up, like a tool palette’s fly-out, a dropdown or a context menu: a mouse press anywhere off it closes it and does nothing else (no button there clicks, scripts don’t see the press and Game.MouseOnUi is true for it), and clicking one of its buttons closes it once the button has done what it does, so an Open Panel button on it opens its window in its place. Untick Pause Game for one the game goes on behind. (Field: on or off.)
  • first: text = null. The name of the control to pick as it opens, e.g. “Resume”. Empty picks its top one. (Names an entity inside this one.) (Field: an entity’s name.)
  • sound: text = null. A sound played as it opens, e.g. “Sounds/open.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)

What anything can make it do with no code: a Trigger’s do when its message arrives, a Contraptions Wire’s input as its signal comes on, a script’s Game.Do(entity, “Name”).

  • Open. Opens it over the game, as its Open Message does.
  • Close. Closes it, and any panel opened inside it.

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

  • isTop: true or false. True while it’s the open panel on top, the one the player’s input goes to.

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