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:
The layout is the screen: the text, boxes and buttons the user sees.
The event sheet is what makes it work. Each event is a row: on the left, when something happens; on the right, what to do then.
Today's app remembers your practice total in a global variable: a named box that holds a number for the whole app.
How this lesson works: Predict, Try, Investigate, Modify, Make
Predict: Read the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Try: Try it on the board and compare the result with your prediction.
Investigate: Work out why it happens, one step at a time.
Modify: Change the problem on purpose and see what happens.
Make: Make your own problem using what you have learned. Expect a few tries; that is normal.
Make your prediction first. Help opens once you've locked it in.
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
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
Choose New project, call it Practice tracker and choose Create.
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.
Insert a Text Input below it. This is the box the user types in.
Insert a Button beside it. Set its Text to Save, and set its Name to SaveButton.
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
Open Event sheet 1 from the Project panel on the right.
Right-click the sheet and choose Add global variable. Name it Minutes, type Number, starting value 0.
Choose Add event, then SaveButton, then On clicked.
Choose Add action, then System, then Add to. Pick Minutes and type 15.
Press the Preview button (the play arrow) and click Save a few times. Does the screen change?
Show the total
Add a second action to the same event: TotalText, then Set text. Type exactly: "You've practised "&Minutes&" minutes"
Preview again and click Save. Now it changes.
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
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.
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?
Lesson done. You've finished every step you need.
Now you can
Lay out a screen in Construct with text, a text box and a button.
Make a button change a number the app remembers.
Make the screen show the new number after it changes.
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.
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.
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.
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
Nothing happens when Save is clicked. Ask: Which object did you pick in Add event? Fix: 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. Ask: Which parts are inside the quote marks? Fix: Only the words to show go in quotes. Minutes and the & signs go outside them.
Typing a number adds 0. Ask: What does the add action use? Fix: It should be int(TextInput.Text), with the Text Input's name if it was renamed.
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
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.