Skip to content
Evansii edited this page May 3, 2019 · 3 revisions

2.5. Switch

A switch allow to group multiples elements as children in the storyboard. It is useful for element that are not displayed at the same time in the scene and that replace each other. For example, if your game contains a closed drawer, at some point, the player will find a key to unlock it. When he use the key on the drawer, the sprite can change to the one locked to another, unlocked. These 2 sprites will be placed under the same switch. For a more concrete demonstration of this example, here's the follow up code in the JSON:

...
"id": 41,
    "class": "switch",
    "description": "TV on/off",
    "display": {
      "node": [42]
    },
    "children": [42,48]
  },

...

If we stick to the previous example, the id 42 correspond to the closed drawer (displayed at the start), and the id 48 correspond to the open drawer that will be displayed later.

The property display is a little bit different from the habitual display. Here we don't provide a media but just the id of the node you to display at start (property node).

Clone this wiki locally