Students build a water tracker with two variables (Glasses, Goal), an Every tick event that keeps the display up to date, Add and Reset buttons, and a cap. The cap is first built the way beginners often write it (Add 1 left on the AddButton event, the check in a sub-event), so it fails at the goal; students find why and move the action into the sub-event. The Make step adds a goal message with Else and a progress bar.
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 5 min · Build 1–3 20 min · Check 8 min · Build 4 5 min · Make it yours 20 min
The cap in Build 2 is wrong on purpose: Add 1 stays on the parent AddButton event, so it runs on every click and the sub-event's condition (Glasses < Goal) controls nothing. The Investigate step finds it; the Modify step fixes it by deleting the action and adding it again inside the sub-event (App Builder has no drag between events; the ⋯ menu and + Action do it).
Every tick runs about 60 times a second. Setting text there is fine. Adding to a variable there is not (it would add 60 a second), which is why the exit question asks about it.
The Build step's tick boxes accept the slip on purpose (they check the cap as built); Build 4's tick only comes once Add 1 is inside the sub-event.
Pick any goal and thing to track if water doesn't suit your class (pages read, laps, minutes outside). The app is about counting towards a goal, not health advice.
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.
Setting the display in every event is easy to forget. An Every tick event keeps everything in step with the variables, whatever changed them.
Draw the AddButton event with its sub-event as two boxes, one inside the other. Ask students to place the Add 1 action where step 7 put it. Ask: when the condition Glasses < Goal is false, which box is skipped? Is the action in it?
A sub-event's condition only controls what's inside the sub-event.
The deliberate slip in Build 2 can feel like a trick. Say up front that the build includes one mistake beginners often make, and the class will find it together.
| What you will see | A question to ask | The fix |
|---|---|---|
| The count shows the word Glasses or the & signs. | Which parts are inside the quote marks? | Only the words to show go in quotes; the variables and & go outside. |
| The bar doesn't move. | Which event sets its width, and is it on BarFill? | The Set BarFill width action goes in the Every tick event. |
| After the fix, Add does nothing. | Where is the Add 1 action now? | It should be inside the sub-event, beside Glasses < Goal, not deleted. |
One possible solution for each task. Other correct programs are fine.
Open task: any program that does what the step asks.
{"version":1,"name":"Water tracker","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"}]}],"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"}],"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":[]}]}],"device":"web"}
Stretch: Let the user set their own goal with a text input and a Set goal button (int() from lesson 1).
Support: Give the finished Every tick event as a table and have students check theirs row by row.
What goes wrong if you put "add 1 to Glasses" in the Every tick event?
It adds 1 about 60 times a second, so the count shoots up. Every tick is for keeping the display in step, not for changing the count.
Next: Values journal, with three screens, a choice that carries between them, and a list.