← Construct apps

A practice tracker

Build a prototype of a practice tracker: type how many minutes you practised, click Save, and the app adds it to your total. A global variable remembers the total, a button event changes it, and the screen only shows the new total when an event sets the text.

Apps that track things, like steps, screen time or practice, all do the same small job underneath: remember a number, change it when you do something, and show it.

A prototype is an early version of an app that you can click through and test, before anyone spends weeks building the real thing. In this course you'll build prototypes with Construct 3, a tool that runs in your browser.

A Construct app has two halves:

Today's app remembers your practice total in a global variable: a named box that holds a number for the whole app.

The practice tracker: a title, a box to type minutes, a Save button, and a line saying "You've practised 45 minutes".

How this lesson works: Predict, Try, Investigate, Modify, Make
PredictRead the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.

Does the total change?

When (condition) Do (actions)
Save: on clicked System: add 15 to Minutes
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?

TryTry it on the board and compare the result with your prediction.

Try it: an app with no Set text

This is the version from the prediction. The event sheet beside it lights up each time an event runs, and the line under the app shows the variable's real value. You'll build the version that works.

Try it yourselfYour edits are saved in this browser.

Click Save three times. Watch the variable and the screen. Then try a different number.

Use the board. This ticks when you get there.

TryTry it on the board and compare the result with your prediction.

Build it: the practice tracker

Open Construct at editor.construct.net. It runs in the browser and you don't need to sign in.

Make the screen

  1. Choose New project, call it Practice tracker and choose Create.
  2. Double-click the layout to insert a Text object. In the Properties panel on the left, set its Text to Practice tracker and make it bigger. Drag it to the top.
  3. Insert a Text Input below it. This is the box the user types in.
  4. Insert a Button beside it. Set its Text to Save, and set its Name to SaveButton.
  5. Insert one more Text below. Set its Text to You've practised 0 minutes and its Name to TotalText.

Give objects names that say what they are. You'll pick them from a list in the event sheet, and Text3 won't tell you which one it is.

Make it work

  1. Open Event sheet 1 from the Project panel on the right.
  2. Right-click the sheet and choose Add global variable. Name it Minutes, type Number, starting value 0.
  3. Choose Add event, then SaveButton, then On clicked.
  4. Choose Add action, then System, then Add to. Pick Minutes and type 15.
  5. Press the Preview button (the play arrow) and click Save a few times. Does the screen change?

Show the total

  1. Add a second action to the same event: TotalText, then Set text. Type exactly: "You've practised " & Minutes & " minutes"
  2. Preview again and click Save. Now it changes.
  3. Last, use what the user typed. Change the 15 in the Add to action to int(TextInput.Text). Preview, type a number and click Save.

Save a copy of your project to your computer before you close the tab.

InvestigateWork out why it happens, one step at a time.

How the text is made

Minutes is 45. The Set text action says "You've practised " & Minutes & " minutes". What does the screen show?

Why does the add action use int(TextInput.Text) and not just TextInput.Text?

Nib's screen never changes from 0 minutes. Click the line that explains why.

ModifyChange the problem on purpose and see what happens.

A Reset button

Insert a Button with the text Reset and name it ResetButton. In the event sheet, add ResetButton, On clicked, then the two actions. To set a variable, use System, then Set value.

You add a Reset button. Which actions does its On clicked event need?

MakeMake your own problem using what you have learned. Expect a few tries; that is normal.

Count the sessions

Add a second global variable, Sessions, that goes up by 1 each time you click Save. Show it in a new Text object, such as Sessions: 3. Make Reset clear it too.

Then show your tracker to someone. Ask them to use it without help. What did they try that you didn't expect?

Now you can
Next lesson2. A chores checklistBuild a checklist where clicking a box ticks it, and clicking again unticks it. Two separate events with the same trigger both run on one click and undo each other, so the toggle is one event with a sub-event and an Else: one trigger, two branches, and only one branch runs.
For teachers

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. About 60 minutes.

Open the teacher guide: answers, solutions, slides and a worksheet.

Students will be able to

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.

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

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.

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.

What each step is for