Students build a practice tracker in Construct 3: a text input, a Save button and a total. A global variable holds the total, the button's On clicked event adds to it, and a Set text action shows it. The first build leaves out Set text on purpose, so students see the variable change while the screen doesn't.
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 lay out a screen in Construct with text, a text box and a button.
I can make a button change a number the app remembers.
I can make the screen show the new number after it changes.
Timing
Predict 3 min · Build it 30 min · Investigate 10 min · Modify 7 min · Make 10 min
Before class
Try it first on a student laptop: open editor.construct.net and start a new project. Construct needs WebGL (graphics support in the browser); without it, the layout won't open.
The free edition is enough: no sign-in, no seats. This app uses 1 to 3 events; the free edition allows 50. Construct keeps nothing for students unless they sign in, so they should save a copy to their device (or the school's storage) before closing the tab. If your school uses cloud storage, Construct's Settings can save to 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.
The one idea: a variable remembers a number, an event changes it, and the screen only shows the new number when an event sets the text. Step 10 is the reveal: the total changes, the screen doesn't.
If students type words instead of a number, int() gives 0, so nothing is added. That's a good question for later (checking input), not this lesson.
Running the lesson
Predict: most say 45. Leave it open until step 10.
Build it: stop the class at step 10. Ask: is Minutes 45? How would we know? What did we never tell the screen to do?
Investigate: read the Set text expression aloud together, piece by piece.
Modify: before they build Reset, ask what would go wrong with only one of the two actions.
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 that counts something for you (steps, screen time, a streak). What does it have to remember, and when does the number on the screen change?
What happens the moment you do the thing it counts?
Does the number on screen change before, at the same time, or after?
Every tracker remembers a number (a variable), changes it when something happens (an event), and shows it (setting the text). Today's prototype does all three.
Does the total change?(predict, 3 min)
Show the one-event table. Hands up for each option after three clicks. Don't settle it: step 10 of the build is the reveal.
Most say 45. Minutes is 45; the screen still says 0.
Read the text(investigate) Minutes is 20. The text is set to "Total: " & Minutes. What shows? Total: 20 Quoted words are shown as they are; Minutes is replaced by its value; & joins them.
The hard part (on purpose)
Finding things in Construct the first time: the Properties panel, the Project panel, and where Add event and Add action are. Expect the first 10 minutes to be slow. Naming objects (SaveButton, TotalText) pays off as soon as students open the event sheet.
When students get stuck
What you will see
A question to ask
The fix
Nothing happens when Save is clicked.
Which object did you pick in Add event?
Check it's the button's On clicked, and that the button is the one named SaveButton. Also check the layout's Event sheet property says Event sheet 1.
The text shows the words Minutes or & on the screen.
Which parts are inside the quote marks?
Only the words to show go in quotes. Minutes and the & signs go outside them.
Typing a number adds 0.
What does the add action use?
It should be int(TextInput.Text), with the Text Input's name if it was renamed.
Answers to the checks
does the total change?: The total starts at 0, and the screen says "You've practised 0 minutes". The only event is: Save on clicked → add 15 to Minutes. You click Save three times. What does the screen say now? It still says 0 minutes. Minutes is now 45, but nothing told the text to change. The screen only shows a new total when an event sets the text.
Try it: an app with no Set text: Click Save three times. Watch the variable and the screen. Then try a different number.
Minutes goes up with every Save, but the screen still says 0 minutes: this version's Save event has no Set text.
Read the text: Minutes is 45. The Set text action says "You've practised " & Minutes & " minutes". What does the screen show? You've practised 45 minutes Words in quote marks are shown as they are. Minutes, outside the quotes, is replaced by its value. The & signs join the pieces into one line.
Why int()?: Why does the add action use int(TextInput.Text) and not just TextInput.Text? A typed box holds text; int() makes it a number A Text Input always holds text, even when you type 20. int() turns the text "20" into the number 20, so it can be added to Minutes.
Find Nib's mistake: Nib's screen never changes from 0 minutes. Click the line that explains why. line 2 Line 2: On start of layout runs once, when the app opens. After that nothing sets the text again, so it keeps saying 0. Nib needs a Set text action in the Save event too.
Choose the actions: You add a Reset button. Which actions does its On clicked event need? Set Minutes to 0, then set the text to show the total Reset changes the variable and the screen, so it needs both: System, set value of Minutes to 0, then TotalText, set text.
Stretch and support
Stretch: Make the total read in hours and minutes once it's over 60 (hint: floor(Minutes / 60) and Minutes % 60).
Support: Pairs: one reads the step, one clicks, then swap for the event sheet half.
Exit ticket
A variable called Score goes from 3 to 4 when a button is clicked, but the screen still says 3. What's missing?
A Set text action in the button's event, so the screen shows the new score.
What each step is for
does the total change?: Committing to an answer sets up the lesson's move: changing a variable doesn't change what's on the screen. An event has to set the text.
Try it: an app with no Set text: Clicking Save on a version with no Set text settles the prediction on the page: the variable changes, the screen doesn't.
Build it: the practice tracker: Building the first version settles the prediction (the total changes but the screen doesn't), then adding Set text fixes it.
how the text is made: Reading the Set text expression and Nib's mistake both point at the move: the screen shows whatever the last Set text said, and only an event changes it.
a Reset button: A Reset button needs both moves again: change the variable, then set the text. Choosing both is the check that the move has stuck.
count the sessions: A second variable and a second Set text show that each number the app remembers needs its own variable, changed and shown by events.
Where it leads
Next: Chores checklist, which makes a tick that turns on and off with sub-events and Else.
Students who go on to the games course meet events and variables again, in a game.