Lesson Notes — Showing Stats with Header and Footer Passages
Course 2: Game Design & Development Principles / Unit 5: Game Design Storytelling & Nonlinear Narratives / Lesson 12: Showing Stats with Header and Footer Passages
Save your work every day: Export your story and save it to Google Drive at the end of every class. Twine only saves your story in the browser on the laptop you are using, and you may not get the same laptop next time.
Lesson overview
In Lesson 10 you stored the player’s choices in variables. Today you show those variables to the player on every screen, like a game’s HUD (heads-up display). You do this with special passage tags.
How to add a tag
Open a passage and use the + Tag button at the top of the passage editor. Type the tag name exactly.
| Tag | What it does |
|---|---|
startup |
Runs once, when the game starts. Nothing in it appears on screen except text you write. |
header |
Its text appears at the top of every passage. |
footer |
Its text appears at the bottom of every passage. |
Step 1: Make a startup passage
Create a new passage named Setup, tag it startup, and move your starting values into it:
(set: $studied to false)
(set: $confidence to 0)
(set: $item to "nothing")
Now your variables are set before the first passage appears, no matter which passage is first.
Step 2: Make a footer that shows stats
Create a passage named Stats and tag it footer. Typing a variable’s name shows its value:
---
Confidence: $confidence
Carrying: $item
(if: $studied is true)[Studied: yes]
The --- draws a line between the story and the stats.
Step 3: Change the stats during the story
(set: $confidence to $confidence + 1)
(set: $item to "a pencil")
Play your game and watch the footer change as you make choices.
Tips
- Only show stats the player needs to make decisions.
- Use a
headerinstead if you want stats at the top. - Your stats can open new paths with
(if:), for example a choice that only appears when confidence is 3 or more.
Your turn
- Move your starting values into a passage tagged
startup. - Make a
headerorfooterpassage that shows at least two stats or items. - Change those stats in at least 3 passages.
- Play your game and check that the stats change correctly.
- Export your story and save it to Google Drive at the end of every class.
Check your understanding
- What is the difference between a
startuppassage and afooterpassage? - Why move your starting values into a
startuppassage? - Which stat in your game matters most to the player’s choices? Why?
Use this lesson’s Key Terms page to build your glossary.