Students build a three-screen journal: choose a value, describe what they did, and see every entry in a list. A global variable (Chosen) carries the choice between layouts, an Array (Journal) stores entries with Push, and screen 3 rebuilds a List from the array with Repeat and loopindex in a separate event from Clear.
Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
WorksheetOpen in PrintDownload Print the student copy; the Teacher edition has the answers.
Students will be able to
I can make an app with more than one screen and buttons that move between them.
I can use a global variable to carry a choice from one screen to the next.
I can store entries in an array and show them in a list.
Timing
Predict 3 min · Build it 40 min · Investigate 12 min · Modify 5 min · Make 15 min
Before class
The values are examples. Use your school's own values if it has them, or let students choose four that matter to them. Entries are personal: students keep the app on their own device and nothing is collected or shared. Keep any class discussion on made-up entries.
Check before class: the Array's Global property. If the array isn't kept between layouts, entries pushed on screen 2 won't be there on screen 3. Step 4 tells students to make sure Global is ticked; confirm the property name in the current editor.
When a layout is added, Construct usually offers to add an event sheet too. If a student has extra or missing sheets, click an empty part of each layout and set its Event sheet property.
Step 12 and 13 must be two separate events. If Clear sits in the same event as the Repeat, it runs on every repeat and only the last entry is left (the Investigate bug).
The journal forgets everything when the preview closes. That's fine for a prototype; saving between sessions (Local Storage) is a stretch.
These steps were written fresh for this site and have not yet been checked click by click in the current editor. Run through them once before class.
Running the lesson
Predict: ask what 'global' might mean before the reveal.
Build it: checkpoint after step 10: does screen 2 show the chosen value? Fix that before arrays.
Investigate: write loopindex 0, 1, 2 under three entries on the board, and point to At(0), At(1), At(2).
Make: pair students from different tables, so the tester hasn't seen the app built.
In class
On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.
Think, pair, share(start) Think of an app you use with several screens, such as ordering food. What does each screen need to know from the screen before?
What would go wrong if the next screen forgot it?
Where might the app keep it?
Something has to outlast the screen change. In Construct that's a global variable (one value) or a global array (a list).
Sketch the flow first(run, 5 min)
Before building, students draw the three screens as boxes on paper and an arrow for every button that moves between them. Label each arrow with the event that causes it.
One layout per box, one Go to layout per arrow. The sketch is the plan the event sheets follow.
The hard part (on purpose)
This is the longest build in the course, and the most common failure is a layout using the wrong event sheet, so nothing on that screen happens. Check each layout's Event sheet property before anyone debugs further.
When students get stuck
What you will see
A question to ask
The fix
A screen's buttons do nothing.
Which event sheet does this layout use?
Click empty space on the layout and set its Event sheet property to the sheet with its events.
Screen 3's list is empty.
Is the Journal array Global, and does the Push run before Go to layout?
Tick Global on the array, and keep Push above Go to layout in AddButton's event.
Only the last entry shows.
Are Clear and Add item in the same event?
Move Clear into its own On start of layout event above the Repeat event.
Answers to the checks
does the choice survive?: On screen 1 you click Courage. Its event sets the global variable Chosen to "Courage", then goes to screen 2. Screen 2's On start of layout sets its question to "What did you do to show " & Chosen & "?". What does the question say? It says Courage. A global variable belongs to the whole app, not one screen, so it keeps its value when the app goes to another layout.
Try the finished app: Add two entries with different values. Watch Chosen and Journal.Width under the event sheet.
Chosen keeps its value from screen 1 to screen 2, and Journal.Width goes up by one with each entry.
Count with loopindex: The journal has 3 entries, so Journal.Width is 3. The Repeat runs 3 times. What is loopindex each time? 0, then 1, then 2 loopindex starts at 0 and goes up by 1 each time round, so 3 repeats give 0, 1, 2. The first entry is Journal.At(0), so each repeat adds the next entry to the list.
Find Nib's mistake: Nib's journal only ever shows the latest entry. Click the line where Nib first goes wrong. line 2 Line 2: Clear is in the same event as the Repeat, so it runs on every repeat. Each time round the list is cleared, then one entry is added, so only the last one is left. Clear belongs in its own On start of layout event.
Why global?: What if Chosen were an instance variable on a button in screen 1, not a global variable? Screen 2 couldn't read it When the app goes to Layout 2, screen 1's objects (and their variables) aren't there. A global variable belongs to the whole app, so every screen can read it.
Choose the expression: Screen 3 should say "You've added 5 moments". Which expression gives the 5? Journal.Width The array grows by one each time you push an entry, so its Width is the number of entries.
Stretch and support
Stretch: Save the journal between sessions with the Local Storage object (Array AsJSON and Load), or show the newest entry first.
Support: Build screens 1 and 2 as a class first, then let students build screen 3 in pairs.
Exit ticket
A shopping app has a Cart screen and a Pay screen. The Cart screen sets a variable Total to 25. How can the Pay screen show $25?
Make Total a global variable; it keeps its value when the app goes to the Pay layout, so the Pay screen can set its text from it.
What each step is for
does the choice survive?: Predicting whether the chosen value reaches screen 2 sets up the move: a global variable keeps its value when the app goes to another layout.
Try the finished app: Using the finished three-screen app first gives a target for the long build and shows the global variable carrying the choice.
Build it: three screens: Building the three layouts, and seeing the chosen value appear on the next screen, settles the prediction and sets up the array and list.
lists and loops: Tracing loopindex and finding Nib's combined event check how the list is built from the array, using the global array the move depends on.
count the entries: Showing the count reuses the array's Width, an existing value, rather than a new variable, which checks students know what the array holds.
test the flow: Watching a user move through three screens is the design half of a prototype: the flow that made sense to the builder isn't always clear to someone else.
Where it leads
Next: Creature stats, where one object has many copies, each with its own values.