Teaching at home? The family edition is the same lesson, written for a parent and one to three kids.

Slides for the board (PowerPoint, 13 slides) Lesson PDF Google Slides: upload the PowerPoint file to Google Drive and open it with Google Slides.

BlocksVR: Click to Change

Grades 4-7 · 45 minutes · Computer science

In a small 3D garden, a box spins and changes color every time it is clicked. Students open its rules and find two plain sentences: always spin slowly, and when I get clicked, change to a random color. That is an event and an action. Then they give the other three things rules of their own, built from cards rather than typed code: a ball that grows, a cone that says hello, and a donut that counts clicks and shows You win at five. Along the way they find out why grow bigger only works once.

At a glance

Essential question

How does a program know when to do something?

Objectives

Students will be able to:

  • name the event and the action in a rule
  • explain that a rule is checked over and over, and acts only when its event happens
  • write rules from cards that make things respond to a click
  • test a rule, notice when it does not do what was expected, and explain why

Vocabulary

event, action, rule, program, bug, score

Standards

1B-AP-10, 1B-AP-15, 2-AP-17

Time and materials

45 minutes, grades 4-7.

  • One computer or Chromebook per student or pair, with a mouse if possible
  • A projector
  • The worksheet and exit ticket, one copy each per student
  • The rubric, one copy per student if you grade the worksheet

Prep

Make copies of the worksheet and exit ticket. Before class, open mytekdev.com/try/blocksvr?lesson=click-to-change&ref=tpt-blocksvr-3 once on a student computer, press Play and click the box, to check that your school's filter allows it. A 3D world takes a few seconds to load. No account is needed.

Assessment

  • Formative: the questions under What to look for, asked while students work, and the exit ticket (answer key included).
  • Summative: the completed worksheet and the student's garden with three working rules, scored with the rubric out of 12.

Technology and privacy

Runs in any browser, Chromebooks included, with nothing to install. Students need no account and no email: the link works signed out, and nothing they make is stored on our server unless they choose to save it to an account. A 3D world asks more of a computer than a flat page; on an older Chromebook, close other tabs first. If your school blocks new sites, ask IT to allow mytekdev.com.

Lesson sequence

MinutesStageWhat you doWhat students do
0 to 6Warm-up
Hook
Show the title, essential question and Today I can slides (about 1 minute). Students open the link or scan the QR code on the worksheet. The world is a small garden with a box, a ball, a cone and a donut. A short guide runs along the top; students press Play, click the blue box a few times (drag to look around if they need to), and press Stop. Ask: "You clicked the box and it changed color. How does it know you clicked it?"Click the box in Play and answer the question.
6 to 14Direct instruction (I do)
Read the rules
On the projector, click Box in the Your world list on the left (the guide's last step). In the panel on the right, the box's behavior card names its program, box; press Edit. The drawer opens on Rules: two cards, each a When menu, an arrow and a second menu. When always (every moment), then spin slowly. When I get clicked, then change to a random color. Name the parts: the When is the event, the menu after the arrow is the action, and together they are a rule. The program checks its rules over and over, many times a second, and the click rule acts only in the moment a click happens. Then switch to Code to show the same rules as code: spin(45), and if (wasClicked()) { setColor(randomColor()); }.Copy the box's two rules into the worksheet, marking each event and action.
14 to 22Guided practice (We do)
The ball
Students click Ball in the list and press + Add behavior. The rules drawer opens on a new program that starts with the same two rules as the box. They change the click rule's second menu (what to do) to grow bigger, then Play and click the ball twice. It grows on the first click and not on the second. Ask why. Grow bigger means twice its normal size, not twice its size now, so a second click asks for a size it already has. That is a bug in the plan, not in the computer: the computer did exactly what the rule said. One fix: add a rule that sets it back, every 2 seconds, go back to normal size, so the next click can grow it again.Give the ball a rule, test it twice, and explain what happened.
22 to 38Independent practice (You do)
The cone and the donut
Students give the cone a behavior and change its click rule to say Hello!. Then the donut: its click rule becomes add 1 point, and they press + Add a rule for a second card: When the score reaches 5, then show You win! after the arrow. On every new card they choose both menus, the When and the what-to-do; a new card does nothing until both have been chosen. They Play and click the donut five times: the score climbs, and the fifth click wins. Students who finish swap a When for a different event (the player is near me, every 2 seconds, the space bar is pressed) and predict the result before they Play. Walk the room and ask the questions under What to look for.Write rules for the cone and the donut, test the click-five-times game, then try a new event.
38 to 45Closure
Say it back, and exit ticket
Ask the essential question again. From the class: a program keeps checking its rules, and a rule acts when its event happens; the same event can start different actions, and a rule does exactly what it says, which is not always what we meant. Then hand out the exit ticket.Answer the essential question out loud, then the exit ticket on their own.

What to look for

Ask these while students work. A student who has understood the lesson can answer them without help:

The last one is the real test. A student who says five clicks in all, on either thing, because the score is one number the whole world shares, understands that rules on different things can change the same game state.

Cross-curricular extensions

Vocabulary

eventSomething that happens, such as a click or a key press, that a program can notice.
actionWhat the program does when the event happens, such as changing color.
ruleA when and a do together: when this happens, do that.
programThe set of rules a thing follows.
bugA program doing something different from what you meant.
scoreA number the whole world keeps, which rules can add to and check.

Differentiation

English learners

  • Post the vocabulary with a picture for each word: a mouse click for event, a paintbrush for action.
  • Read each rule card aloud as a sentence: when I get clicked, change color.
  • Let students act out a rule in pairs: one claps (the event), the other turns around (the action).

Students with IEPs or 504 plans

  • Where the IEP allows a modified assignment, do the ball and the cone only.
  • Give the rule cards to copy as written, one per thing.
  • Pair students: one clicks in Play, the other changes the rules.
  • Read the exit ticket aloud.

Students who need more support

  • Do the ball together on the projector, step by step, before students work alone.
  • Remind students to press Stop before changing rules, and Play to test.
  • Check in at minute 28: does the donut's second card have both menus chosen?

Students ready for more

  • Make the donut also turn green when the score reaches 5, as well as showing You win!.
  • Open Code and change spin(45) to spin(360). What changed? What does the number mean?
  • Give the box another rule card: when the player is near me, run away from the player. Can you still click it?

Adapting for other grades

Younger students: For grades 2 and 3, do every step together on the projector and keep to the box and the ball. Score the first and third rubric rows only (out of 8; 6 or more meets the objectives).

Older students: For grades 8 and 9, do the whole lesson in the Code view: write each rule as an if statement, explain why the click rule needs no else, and fix the ball's bug with a variable that remembers how big it is.

BlocksVR: Click to Change

Student worksheet

Name: ______________________________ Date: ______________

Open the app: scan the QR code, or go to mytekdev.com/try/blocksvr?lesson=click-to-change

Essential question: How does a program know when to do something?

ThingWhen (event)Do (action)It worked? Yes or no
BoxI get clickedchange to a random color 
Ball   
Cone   
Donut (rule 1)   
Donut (rule 2)   
  1. Give it rules. Click a thing in the list and press + Add behavior; its rules open. Change the cards. (Edit reopens them later.)
  2. Test it. Press Play and click it. Press Stop before you change a rule.

1. Why did the ball grow only on the first click?

2. A new event I tried: When ____________________, Do ____________________. What happened?

BlocksVR: Click to Change

Exit ticket

Name: ______________________________

1. In the rule "When I get clicked, do turn red", what is the event? (A) turn red, (B) I get clicked, (C) the rule.

2. A ball has the rule "When I get clicked, do grow bigger." You click it three times. How big is it? (A) twice its normal size, (B) eight times, (C) normal size.

3. Write a rule that makes something spin fast when the player is near it.

Answer key: worksheet and exit ticket

From the app's rule cards. A new behavior starts with the box's two rules (always: spin slowly; I get clicked: change to a random color). Grow bigger sets the size to twice normal, so later clicks change nothing. Add 1 point adds one per click; the score is shared by the whole world.

ThingWhenDo
BallI get clickedgrow bigger
ConeI get clickedsay "Hello!"
Donut, rule 1I get clickedadd 1 point
Donut, rule 2the score reaches 5show "You win!"
Exit ticketAnswerWhy
1BThe event is what happens; the action is what the program does.
2AGrow bigger means twice the normal size, every time.
3When the player is near me, do spin fastFull credit for a player-near event with a spin action, as cards or as code: if (playerDistance() < 4) { spin(360); }.

Rubric

Score each row from 1 to 4.

Name: ______________________________

Criteria4 Exceeds3 Meets2 Approaching1 Beginning
Names events and actionsNames the event and action in every rule, and explains that rules are checked over and over.Names the event and action in every rule.Names some events or actions.Does not separate events from actions.
Writes working rulesThe ball, cone and donut all work, the donut wins at 5, and a new event was tried.The ball, cone and donut all work, and the donut wins at 5.Some rules work, or the win never happens.No rules are written.
Tests and explainsExplains the grow bigger bug and fixes or works around it.Explains why the ball does not grow a second time.Notices the ball stops growing but cannot explain it.Did not test.

Total: ____ / 12. A score of 9 or more meets the objectives.

Standards

Events in programs are the center of this lesson, with testing and fixing.

FrameworkCodeGradesStandardHow the lesson meets it
CSTA 20171B-AP-103-5Create programs that include sequences, events, loops, and conditionals.Students write rules that respond to click and score events, checked over and over while the world runs.
CSTA 20171B-AP-153-5Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intended.Students test each rule in Play and explain why grow bigger works only once.
CSTA 20172-AP-176-8Systematically test and refine programs using a range of test cases.Students test the donut's win at exactly five clicks and try new events with a prediction first.

Checked October 2026 against: CSTA 2017 progression chart.

Optional: save student work in a free class

The whole lesson runs at the link on the worksheet, with no accounts and no sign-up. Work stays in the browser tab until it is closed.

To keep students' worlds, and see every student's work in one place, make a free class. It takes about ten minutes, once, and covers every lesson in this series: mytekdev.com/tools/class-setup

Students in a class open mytekdev.com/tools/blocksvr/lessons/click-to-change/start instead of the worksheet link. Each one gets their own copy of the starter, and the same link reopens it next time. A student who started at the worksheet link and then signs up keeps what they made.

BlocksVR is a mytekDev app, open source under the GNU General Public License 3.0, built on A-Frame (MIT License).