Students build a water tracker with two global 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 On clicked 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.
WorksheetOpen in PrintDownload Print the student copy; the Teacher edition has the answers.
Students will be able to
I can use Every tick to keep what's on screen up to date.
I can say which actions a sub-event's condition controls.
I can make a progress bar from a number.
Timing
Predict 3 min · Build it 20 min · Investigate 12 min · Modify 5 min · Make 20 min
Before class
The cap in step 7 is wrong on purpose: Add 1 stays on the parent On clicked 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 dragging the action into the sub-event.
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.
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; Construct updates itself, so a menu name may differ slightly.
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.
Running the lesson
Predict: compare with lesson 1, where the screen didn't change without Set text. What's different now?
Build it: everyone clicks 12 times at step 9 before anyone explains.
Investigate: draw the event and its sub-event on the board; circle which actions belong to which.
Make: work out one bar width together before students build it.
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) A screen shows the same number in three places: a count, a bar and a message. How could you make sure all three always agree?
What if a new button changes the number? What would you have to remember?
Is there a way to update them without remembering?
Setting the display in every event is easy to forget. An Every tick event keeps everything in step with the variables, whatever changed them.
Which actions does the condition control?(investigate, 5 min)
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 hard part (on purpose)
The deliberate slip in step 7 can feel like a trick. Say up front that the build includes one mistake beginners often make, and the class will find it together.
When students get stuck
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 does it use the right sprite?
The Set width action goes in the Every tick event, on BarFill.
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.
Answers to the checks
who sets the text?: The Add button's event only adds 1 to Glasses. It has no Set text. You click Add. Does the count on the screen change? Yes. The Every tick event sets the text again about 60 times a second, so as soon as Glasses changes, the screen shows it.
Try the finished app: Add glasses until you reach the goal, then try to go past it. Watch the Every tick row on the event sheet.
Every tick keeps the count, the bar and the message in step. The cap is inside a sub-event here, so it stops at 8.
What did you see?: You built the cap as in step 7 and clicked Add 12 times, with a goal of 8. What did the screen say? Glasses: 12 of 8 It went past the goal. The Add 1 action sits on the On clicked event, so it runs on every click. The sub-event's condition only controls actions inside the sub-event, and there are none.
Find the slip: This is the cap you built. Click the line that lets the count pass the goal. line 2 Line 2: the action is on the parent event, so it runs on every click. The sub-event's condition below it only controls actions inside the sub-event. Move Add 1 into the sub-event.
When does it run?: Another event: Glasses = Goal → set Message to "Goal reached!". It has no green arrow. When does it run? Every tick, while Glasses equals Goal Conditions without a green arrow are checked every tick. While Glasses equals Goal, the action runs about 60 times a second. That's fine for setting the same text; it would be a problem for adding to a score.
Work out the width: The bar is a sprite 400 pixels wide when full. Glasses is 2 and Goal is 8. What width should the bar be? 100 2 of 8 is a quarter, and a quarter of 400 is 100. In Construct: Glasses / Goal * 400.
Stretch and support
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.
Exit ticket
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.
What each step is for
who sets the text?: Predicting whether the count changes with no Set text in the button's event sets up the move: Every tick keeps the display in step on its own.
Try the finished app: Using the finished tracker, with its event sheet beside it, gives a target for the build and shows Every tick running all the time.
Build it: the water tracker: The build includes the cap exactly as many beginners write it, so the next step can test it and find why it doesn't stop at the goal.
did the cap work?: Tracing the cap and reading the goal message test the two halves of the move: what a sub-event's condition controls, and conditions checked every tick.
fix the cap: Moving the action into the sub-event is the fix, and testing at the goal confirms students now know which actions a condition controls.
a message and a progress bar: The message and progress bar use the every-tick idea twice, plus an Else from last lesson, so the move is used in a new place.
Where it leads
Next: Values journal, with three screens, a choice that carries between them, and a list.