1. What a variable remembers
An adventure game needs to remember what has happened. Has the player opened the drawer? How many coins do they have? What is the current objective? A variable stores one of those pieces of information under an ID you can refer to later.
For this walkthrough, the player uses a workshop clock. The game remembers whether it has been wound, adds points and changes an objective. Later, a condition checks that memory so the same clock cannot keep handing out points.
| ID | Type and starting value | What it remembers |
|---|---|---|
| clock_wound | Boolean · False | Whether the clock puzzle has been completed. |
| score | Number · 0 | The player’s points. |
| attempts | Number · 0 | How often the first test action has run. |
| objective | String · Wind the workshop clock. | A short instruction that a GUI label can display. |
| clues | Array · ["clock diagram"] | A list of discovered clue labels. |
| last_choice | String · blank/null | No clue has been chosen yet. |
Starting value and current value#
Variable Designer sets the value a fresh game starts with. During play, the game has its own current value. Changing clock_wound to True in play does not tick its starting-value box in the designer.
These designer variables are shared game values. A scene, a character interaction, a GUI and a script can all read the same score. Putting a variable in a database folder does not give that folder its own private copy.
A variable records a fact. It does not automatically play a clock sound, give an inventory item, open a door or change an animation. Add the actions that make those things happen, and use variables to remember the result.
