
- Type
- Lesson plan
- Subject
- Computer Science & Coding
- Grade
- Primary (Grades 3-5)
- Ages
- Ages 8-10
- Duration
- 1 hour
- Level
- Beginner
How can we use events and variables in code to interact with and change the world around us?
Overview
In this lesson, students step into a narrative where a malfunctioning time-travel device has trapped them in a historical time loop. To escape and find the time gate, learners must adopt a coding mindset and apply foundational computer science concepts to solve environmental challenges.
Using Minecraft Education, learners tackle five hands-on coding challenges. They configure event handlers to grant fire resistance and jump boosts, manipulate variables to count placed blocks and cycle block IDs, and coordinate multiple event triggers to control in-game weather.
Learning objectives
By the end of this lesson students will be able to:
- Apply events and event handlers to trigger player abilities and environmental changes.
- Create and update variables to track block counts and change block states.
- Test and debug code to overcome physical obstacles in the world.
- Recognize that multiple algorithms can successfully complete a coding task.
Blocks and items used in this lesson
Key vocabulary
- Event
- An action or occurrence recognized by software, such as walking, swimming, or placing a block.
- Event Handler
- A coding block that waits for an event to occur and executes instructions in response.
- Variable
- A named storage location in a program that holds a value that can be changed.
- Forever Loop
- A programming loop that repeats its instructions continuously while the program is running.
Before class
Lesson sequence
Suggested timing: about 60 minutes in total.
- Introduction and Narrative Setup10 min
Introduce the time loop scenario from the classroom presentation. Explain the core goals: navigating obstacles to reach the time gate by coding with events, event handlers, and variables.
- Movement Code: Lava Swim and The Climb15 min
Guide students through Activities 1 and 2. In Activity 1, students code an On Player Swim event handler with lava resistance default values to cross a shallow lava lake. In Activity 2, students use a Forever event to apply Jump Boost 2, enabling them to jump 2.5 blocks high and reach the next area.
- Variables in Action: Building and World Shift20 min
Direct students to Activities 3 and 4. Students use On Block Placed to increment a counter variable and speak the count, placing at least 34 pyramid blocks (iron, gold, diamond, or emerald) until a beacon appears. Next, they use On Player Walk to increase a count variable that places blocks by ID (1=Stone, 2=Grass, 3=Dirt) at specific coordinates to open a doorway.
- Advanced Challenge: Make it Rain!10 min
Students complete Activity 5 by linking multiple events together. They set variables to true when distinct events fire, then run a forever loop that monitors these variables and makes it rain once all conditions are met.
- Formative Assessment and Wrap-Up5 min
Review key vocabulary and have students answer the lesson reflection questions verbally or on the printable assessment sheet from the educator guide.
Assessment: success criteria
- Student successfully configures event handlers to survive crossing the lava lake and jump 2.5 blocks high.
- Student creates a working counter variable that updates upon placing blocks until 34 pyramid blocks are placed.
- Student uses player movement to increment a variable and place sequential block IDs to open the doorway.
- Student accurately defines an event, a variable, and names at least two event handlers during assessment.
Differentiation
Help students locate the default value settings for fire resistance and Jump Boost 2 within their code blocks.
Encourage students to test different block types for their pyramid or design unique combinations of event handlers to trigger the rain event.
Knowledge check
5 questions to check understanding after the lesson. Tap an answer to see if it is right; the score appears at the end.
1In Activity 2, how high does Jump Boost 2 allow the player to jump?
Answer: C. The lesson details that Jump Boost 2 allows the player to jump 2.5 blocks high to reach the inaccessible area.
2What is the minimum number of blocks students must place to complete the pyramid in Activity 3?
Answer: A. Activity 3 requires students to place at least 34 blocks before the beacon appears at the top.
3Which event handler is used in Activity 1 to grant fire resistance?
Answer: D. Students use the On Player Swim event with Lava Resistance to safely walk through the shallow lava.
4In Activity 4, which block type corresponds to block ID 1?
Answer: B. The activity specification defines 1 as Stone, 2 as Grass, and 3 as Dirt.
5How do students trigger the weather change in Activity 5?
Answer: C. Activity 5 requires setting variables to true when events fire and using a forever loop to check that all events are true before starting rain.
Resources
- Lesson package (.zip)Everything the author attached to this lesson in one download.
- Coding Fundamentals Part 3: The ExperimentEDU Guide and Formative Assessment
- Coding Fundamentals Part 3: The ExperimentClassroom Presentation
- Coding Fundamentals Part 3: Running Out of TimeCurriculum Overview
- Lesson worldOpens the world page in Minecraft Education (sign-in with a school account may be needed).
Part of the Coding Fundamentals curriculum
This is lesson 14 of 17 in Coding Fundamentals.
- Basic Moves and the Agent
- Coding Challenge
- Dinosaur Run
- Earth’s Moon & Mars
- Ganymede (Jupiter's Moon) & Saturn's Rings
- Gray Wolves
- Mercury and Venus
- Minecraft Space Center
- Panda's Protected Habitat
- Polar Bear Rescue
- Revisiting Biomes
- Revisiting Planets
- Sea Turtle Assistance
- The Experiment
- Uranus’ Rings and Neptune's Moon, Triton
- We Need Beets!
- Wild West
Frequently Asked Questions
Do students need to swim through deep lava in Activity 1?
No, the lava lake is only one block deep, so students do not need to swim, but they must use the On Player Swim event handler to gain fire resistance.
Which materials are allowed when building the pyramid in Activity 3?
Students can construct the pyramid using iron, diamond, gold, or emerald blocks.
Where can the printable questions for assessment be found?
A printable version of the formative assessment questions is provided at the end of the educator guide in the supporting files.
Adapted from The Experiment by Minecraft Education on Minecraft Education, last updated Feb 4, 2025. This classroom version, the timings and the quiz were written by 9Minecraft Education.






















