Skip to content

Minigame

Plays another scene on top of this one as a minigame, with no code: an arcade cabinet in a platformer that opens a match-3 board, a lock picked in a falling-blocks puzzle, a card duel in an adventure. Its Play action (from a Trigger, a button, a hotspot or a script) loads Scene into this scene, gives it the player’s input and the whole screen (its own camera, HUD and menus), and pauses everything else (or, without PauseBelow, lets the rest of the game run on out of sight). The minigame ends with a trigger in it doing Win Minigame or Lose Minigame (“when Won arrives, Win Minigame”); then it’s gone, the input goes back to what had it, and this entity sends WonMessage or LostMessage with the score, and shows how it went as outputs (Won, Score, Best…).

The minigame is part of the scene while it’s played (under an entity with a MinigameRoot, set beside the rest of the world so the two never touch), so a rewind goes back into it or to before it opened, and a saved game saves it. It can’t be played during a network game. A trigger’s Play Minigame plays one without this component, with its defaults.

Works with: Trigger (Play when a message arrives; the minigame’s own triggers Win Minigame or Lose Minigame)

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.

  • scene: text = null. The scene played as the minigame, e.g. “Arcade”. (Names a scene.) (Field: a name.)
  • pauseBelow: true or false = true. Pauses everything else in this scene while the minigame is played. Untick it to keep the rest of the game running out of sight (a timer still counting, enemies still coming), though without the player’s input. (Field: on or off.)
  • fade: a number = 0.3. Seconds the screen fades out (and back in) going into the minigame and back. 0 cuts straight there. (Field: a number.)
  • wonMessage: text = “Minigame Won”. A message sent from this entity as the minigame is won, with the score as its data: a trigger opens a door on it. (Names a message.) (Field: a name.)
  • lostMessage: text = “Minigame Lost”. A message sent from this entity as the minigame is lost (or quit), with the score as its data. (Names a message.) (Field: a name.)
  • won: true or false = false. True if the last time it was played it was won. Kept by the game. (Field: on or off.)
  • score: a whole number = 0. The score it was last won or lost with. Kept by the game. (Field: a number.)
  • best: a whole number = 0. The best score it has been won with. Kept by the game. (Field: a number.)
  • plays: a whole number = 0. How many times it has been played to the end. Kept by the game. (Field: a number.)
  • wins: a whole number = 0. How many times it has been won. Kept by the game. (Field: a number.)

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”).

  • Play. Plays the minigame (not while it’s already being played).
  • Stop. Ends the minigame being played, as lost.

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.

  • Won (true or false). True if the last time it was played it was won. Kept by the game.
  • Score (a whole number). The score it was last won or lost with. Kept by the game.
  • Best (a whole number). The best score it has been won with. Kept by the game.
  • Plays (a whole number). How many times it has been played to the end. Kept by the game.
  • Wins (a whole number). How many times it has been won. Kept by the game.
  • Playing (true or false). True while its minigame is being played.

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

  • playing: true or false. True while its minigame is being played.

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