← Teacher guide

Creature stats

Students build a character viewer: one Creature Image with three copies, each with its own object variables, and one Creature is clicked event that shows the clicked creature's name, stats as text and bars, and ability. They predict and test that clicking picks one copy, find Nib's mistake (expecting Hide to hide every creature), add a fourth creature without changing the events, then design their own set.

App Builder apps · One object · about 75 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

Try 5 min · Build 1–3 35 min · Check 8 min · Make it yours 25 min

Before class

The creatures are made up (Blaze, Tide, Zip). Students' own sets in Make should be made up or everyday things too; steer away from real people. Built-in pictures are fine; students can upload their own drawings on an Image.

Object variables are added once (they belong to the object) but filled in per copy: click a copy, then set its values in Properties.

Vocabulary (for teachers, and for students who ask): the object is like a class in other languages, each copy is an instance, and object variables are its properties.

Picking is the big idea: a condition picks the copies it's true for, and actions in that event apply only to those. App Builder picks like Construct, so this carries over to the games course.

The code checks read the object variables' names, not each copy's values, so Build 1 (each creature has its own values) is worth checking by eye.

Running the lesson

  1. Before Build 2 (whole class, on the deck): one click event, three creatures. Click Tide: whose name shows? Ask how the app could know which creature you mean.
  2. Build 1: check that every creature has its own values before anyone builds the event.
  3. Check: act it out: three students are creatures, one clicks; only the clicked one obeys the next instruction.
  4. Make it yours: ask what will need changing on the Events tab before anyone adds the fourth creature.

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)

Filling in object variables for each copy: students set the values on one creature and assume the others have them. Each copy must be clicked and filled in separately.

When students get stuck

What you will seeA question to askThe fix
Every creature shows the same stats.Did you fill in the values on each creature separately?Click each copy on the Design tab and set its own object variables in Properties.
Creature.power shows an error: there's no object called Creature.Is the event on the screen that has the creatures?Check the Events tab's heading names the creatures' screen.
A bar is far too long or too short.What should 100 power give?Creature.power / 100 * 200: 100 power is the full 200 width.

Answers to the checks

  1. Which ones hide?: You add one more action to the click event: Hide Creature. You click Zip. Which creatures disappear?
    Only Zip
    Creature is clicked picks the copy you clicked. Every Creature action in that event applies to the picked copy only.
  2. Find Nib's mistake: Nib wanted the other two creatures to hide. Click the line where Nib's thinking goes wrong.
    line 3
    Line 3: in this event the click has picked Tide, so Hide Creature only hides Tide. To hide the others you'd hide every creature in an event that doesn't pick, then show the clicked one.

Solutions

One possible solution for each task. Other correct programs are fine.

Make it yours: a fourth creature, then your own set › A fourth creature

{"version":1,"name":"Creature stats","features":{"level":3},"variables":[],"screens":[{"id":"main","name":"Creatures","objects":[{"name":"Title","kind":"text","instanceVars":[],"instances":[{"id":"t0","x":229,"y":20,"w":342,"h":34,"text":"Click a creature","visible":true,"vars":{}}]},{"name":"Creature","kind":"image","instanceVars":[{"name":"name","value":""},{"name":"power","value":0},{"name":"speed","value":0},{"name":"defence","value":0},{"name":"ability","value":""}],"instances":[{"id":"k0","x":235,"y":70,"w":100,"h":100,"text":"Blaze","visible":true,"vars":{"name":"Blaze","power":80,"speed":60,"defence":30,"ability":"Fire breath"},"image":"star"},{"id":"k1","x":350,"y":70,"w":100,"h":100,"text":"Tide","visible":true,"vars":{"name":"Tide","power":50,"speed":40,"defence":90,"ability":"Water shield"},"image":"water"},{"id":"k2","x":465,"y":70,"w":100,"h":100,"text":"Zip","visible":true,"vars":{"name":"Zip","power":30,"speed":95,"defence":40,"ability":"Super dash"},"image":"music"},{"id":"k3","x":580,"y":70,"w":100,"h":100,"text":"Moss","visible":true,"vars":{"name":"Moss","power":60,"speed":20,"defence":70,"ability":"Root grip"},"image":"smile"}]},{"name":"NameText","kind":"text","instanceVars":[],"instances":[{"id":"k10","x":229,"y":200,"w":342,"h":34,"text":"","visible":true,"vars":{}}]},{"name":"PowerText","kind":"text","instanceVars":[],"instances":[{"id":"k11","x":229,"y":246,"w":120,"h":26,"text":"","visible":true,"vars":{}}]},{"name":"SpeedText","kind":"text","instanceVars":[],"instances":[{"id":"k12","x":229,"y":282,"w":120,"h":26,"text":"","visible":true,"vars":{}}]},{"name":"DefenceText","kind":"text","instanceVars":[],"instances":[{"id":"k13","x":229,"y":318,"w":120,"h":26,"text":"","visible":true,"vars":{}}]},{"name":"PowerBar","kind":"shape","instanceVars":[],"instances":[{"id":"PowerBar","x":355,"y":250,"w":0,"h":18,"text":"","visible":true,"vars":{},"color":"#e5484d"}]},{"name":"SpeedBar","kind":"shape","instanceVars":[],"instances":[{"id":"SpeedBar","x":355,"y":286,"w":0,"h":18,"text":"","visible":true,"vars":{},"color":"#2f8fdd"}]},{"name":"DefenceBar","kind":"shape","instanceVars":[],"instances":[{"id":"DefenceBar","x":355,"y":322,"w":0,"h":18,"text":"","visible":true,"vars":{},"color":"#2fa36b"}]},{"name":"AbilityText","kind":"text","instanceVars":[],"instances":[{"id":"k14","x":229,"y":362,"w":342,"h":30,"text":"","visible":true,"vars":{}}]}],"events":[{"id":"k","else":false,"conds":[{"type":"onClicked","target":"Creature"}],"actions":[{"type":"setText","target":"NameText","value":"Creature.name"},{"type":"setText","target":"PowerText","value":"\"Power: \" & Creature.power"},{"type":"setText","target":"SpeedText","value":"\"Speed: \" & Creature.speed"},{"type":"setText","target":"DefenceText","value":"\"Defence: \" & Creature.defence"},{"type":"setText","target":"AbilityText","value":"\"Special: \" & Creature.ability"},{"type":"setSize","target":"PowerBar","prop":"w","value":"Creature.power / 100 * 200"},{"type":"setSize","target":"SpeedBar","prop":"w","value":"Creature.speed / 100 * 200"},{"type":"setSize","target":"DefenceBar","prop":"w","value":"Creature.defence / 100 * 200"}],"children":[]}]}],"device":"web"}

Make it yours: a fourth creature, then your own set › Your own set

Open task: any program that does what the step asks.

Stretch and support

Stretch: A comparison mode: click two creatures and show their stats side by side (hint: remember the first one's values in sidebar variables).

Support: Give pairs the object variable values filled in (open the Try it app), so they can spend the time on the event.

Exit ticket

An app has 10 coins, each a copy of Coin with an object variable value. The player clicks one coin. The event adds Coin.value to Score. Whose value is added?

Only the clicked coin's: the click picked that copy, so Coin.value means its value.

What each step is for

Where it leads

Next: Tidy up the journal (a function and an All screens event), then the challenge, a prototype of their own for a real user. In the games course, picking and copies come back with many enemies on screen.