← Teacher guide

A practice tracker

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.

Construct apps · Apps that respond · about 60 minutes · Open the student lesson

Classroom resources

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.

Students will be able to

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

  1. Predict: most say 45. Leave it open until step 10.
  2. 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?
  3. Investigate: read the Set text expression aloud together, piece by piece.
  4. 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.

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 seeA question to askThe 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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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

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.