Students add a cheer to the water tracker: a Sound object and Play Cheer in an event about the goal. Because that event has no trigger, it runs every tick, so Play restarts the sound 60 times a second and they hear clicks or nothing. Trigger once while true fixes it: once each time the goal becomes reached. Then a Video object with NASA's The Water Cycle, and Reset stops the cheer.
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.
Try 4 min · Build 1 10 min · Why 5 min · Build 2 6 min · Check 6 min · Build 3 5 min · Make it yours 4 min
This lesson starts from the finished water tracker (Level 2) and comes straight after it. Students need sound: headphones help in a busy room. Browsers play sound only after the user has clicked something, which every student will have done by the time they reach 8 glasses.
The broken version is deliberate. An event with a condition but no trigger (Variable Glasses = Goal) is checked every tick, about 60 times a second, and its actions run every tick while it's true. Play starts the sound from the beginning, so it never gets past the start. (Measured in a browser: about 60 Play calls in the second after reaching 8; with Trigger once, one.) The Goal reached! message has the same every-tick behaviour, but setting the same text again changes nothing, so nobody notices.
Trigger once while true runs once each time the conditions above it become true, then waits until they're false again. Keep it last in the event. It's the same idea as Construct's Trigger once.
The video is NASA/Goddard Space Flight Center's "The Water Cycle" (public domain, https://svs.gsfc.nasa.gov/10501), linked from NASA's site, so it needs the internet when it plays; nothing is uploaded. If NASA's site is blocked at school, any Wikimedia Commons video file page works the same way (App Builder turns the page link into the video).
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.
The app reacts to the moment it reaches 0:00, not to every moment it stays there. Today's tracker needs the same: cheer when the goal is reached, not while it is.
Everyone reaches 8 glasses with Build 1 and listens. Collect what people heard: clicks, a buzz, nothing.
The event runs every tick, so Play starts the sound again 60 times a second. A condition with no trigger is checked every tick: the same reason the display in the water tracker stays up to date.
Hearing nothing at 8 looks like a broken sound, not a timing problem. Ask students to click the Sound object's ▶ in Design first: if that plays, the sound is fine and the question is when Play runs.
| What you will see | A question to ask | The fix |
|---|---|---|
| No sound at all, even after Build 2. | Does the ▶ on the Sound object play? Is the computer muted? | Check the volume, and that Play is on Cheer (the Sound object), not another object. |
| It still clicks after adding Trigger once. | Which event did you add it to? | Add it to the event that plays Cheer, as its last condition. |
| It cheers on every glass. | Which event is Play Cheer in? | Move it out of the Add button's event into its own Glasses = Goal event with Trigger once. |
| The video doesn't play. | Is the link pasted in full, ending in .webm? Is NASA's site blocked here? | Paste the whole link; if the site is blocked, use a Wikimedia Commons video page instead. |
One possible solution for each task. Other correct programs are fine.
{"version":1,"name":"Water tracker (sound and video)","features":{"level":2},"variables":[{"name":"Glasses","value":0},{"name":"Goal","value":8}],"screens":[{"id":"main","name":"Water","objects":[{"name":"GlassText","kind":"text","instanceVars":[],"instances":[{"id":"w1","x":229,"y":40,"w":342,"h":36,"text":"Glasses: 0 of 8","visible":true,"vars":{}}]},{"name":"AddButton","kind":"button","instanceVars":[],"instances":[{"id":"w2","x":229,"y":100,"w":342,"h":52,"text":"Add a glass","visible":true,"vars":{}}]},{"name":"ResetButton","kind":"button","instanceVars":[],"instances":[{"id":"w3","x":229,"y":170,"w":342,"h":46,"text":"Reset","visible":true,"vars":{}}]},{"name":"Message","kind":"text","instanceVars":[],"instances":[{"id":"m1","x":229,"y":240,"w":342,"h":32,"text":"","visible":true,"vars":{}}]},{"name":"BarBack","kind":"shape","instanceVars":[],"instances":[{"id":"m2","x":229,"y":290,"w":300,"h":24,"text":"","visible":true,"vars":{},"color":"#d5dae3"}]},{"name":"BarFill","kind":"shape","instanceVars":[],"instances":[{"id":"m3","x":229,"y":290,"w":300,"h":24,"text":"","visible":true,"vars":{},"color":"#2f8fdd"}]},{"name":"Cheer","kind":"sound","instanceVars":[],"instances":[{"id":"ws1","x":229,"y":330,"w":342,"h":52,"text":"","visible":true,"vars":{},"sound":"win"}]},{"name":"WaterVideo","kind":"video","instanceVars":[],"instances":[{"id":"wv1","x":229,"y":392,"w":342,"h":192,"text":"","visible":true,"vars":{},"link":"https://svs.gsfc.nasa.gov/vis/a010000/a010500/a010501/water_cycle_appletv_1280x720.webmhd.webm"}]}],"events":[{"id":"w1","else":false,"conds":[{"type":"everyTick"}],"actions":[{"type":"setText","target":"GlassText","value":"\"Glasses: \" & Glasses & \" of \" & Goal"},{"type":"setSize","target":"BarFill","prop":"w","value":"Glasses / Goal * 300"}],"children":[]},{"id":"w2","else":false,"conds":[{"type":"onClicked","target":"AddButton"}],"actions":[],"children":[{"id":"w2a","else":false,"conds":[{"type":"compareVar","var":"Glasses","op":"<","value":"Goal"}],"actions":[{"type":"addTo","value":"1","var":"Glasses"}],"children":[]}]},{"id":"w3","else":false,"conds":[{"type":"onClicked","target":"ResetButton"}],"actions":[{"type":"setVar","var":"Glasses","value":"0"},{"type":"stopSound","target":"Cheer"}],"children":[]},{"id":"w4","else":false,"conds":[{"type":"compareVar","var":"Glasses","op":"=","value":"Goal"}],"actions":[{"type":"setText","target":"Message","value":"\"Goal reached!\""}],"children":[]},{"id":"w5","else":true,"conds":[],"actions":[{"type":"setText","target":"Message","value":"\"Keep going\""}],"children":[]},{"id":"ws2","else":false,"conds":[{"type":"compareVar","var":"Glasses","op":"=","value":"Goal"},{"type":"triggerOnce"}],"actions":[{"type":"playSound","target":"Cheer"}],"children":[]}]}],"device":"web"}
Stretch: Add a Pop sound on every glass (it should play every click, so it goes in the Add button's event) and a Stop Pop when the goal is reached. Which events should each sound be in, and why?
Support: Do Build 1 together, then let everyone hear the clicks before explaining why.
A quiz app checks every tick whether Score = 10 and shows a pop-up. The pop-up keeps flashing. What's happening, and what's the fix?
The Score = 10 event runs every tick while it's true, so the pop-up is shown again and again. Add Trigger once while true so it shows once when Score reaches 10.
Next: a values journal with three screens. Trigger once comes back whenever an every-tick condition should act only once.