Introduction
Create a fun and interactive lab safety simulation where students code a mini-game that teaches safety rules before starting an experiment. Players must find safety gear like goggles or gloves before entering the lab. Using simple logic blocks and a Boolean variable, students design scenes where the lab stays “locked” unless the correct item is clicked. This engaging coding project builds decision-making, cause-and-effect reasoning, and interactive storytelling — perfect for science or STEM classes.
Objectives
Students will:
- Design a science lab scene with a clickable safety item
- Create a Boolean variable and set its value based on player actions
- Use a Compare block to check if safety rules are followed
- Add message feedback when the player forgets a safety item
- Test, revise, and polish their game using peer review tools
Code Stories and Games with Elementari
Elementari helps students personalize stories and games with simple coding. In this project, students use Boolean logic to create a basic simulation where decisions matter. By combining scene design with coding triggers, they explore how interactive storytelling can reinforce science concepts like lab safety in a memorable and playful way.
New to Elementari? Click on the orange Start button to jump right into the lesson for free. Check out our Getting Started Guide for an overview of how Elementari works with your class. Get started for free for up to 35 student accounts.
Teacher Notes
Before Coding:
- Have students complete the Writing Organizer to plan their setting, character, safety item, and logic flow.
- Show a sample project that uses a Boolean variable to "lock" access to the lab.
- Model a quick scene where the player can’t enter without goggles — let students test and figure out why.
After Building:
- Students should use Inspect Mode to test their logic and make sure the safety item is required before entering the lab.
- Use the Single Point Rubric and Peer Review template to guide revisions and support success criteria.
- Optional: Provide access to the Coding Cheat Sheet to support students while building their logic.
Lesson Resources
Coding Concepts Covered
Functions in Sequence Function in Parallel User NavigationStudent Instructions
Use your Lab Simulation Writing Organizer to help plan (make a copy):
- What is your lab setting?
- What safety item do players need before entering the lab?
View the Example Project
Create a fun and clear title for your simulation.
Use narration to welcome the player and explain what they need to do before entering the lab. Add a "Continue" button.
Don't add your safety item yet!
Add your safety item to the page.
Create a Boolean variable (e.g. has_goggles) and set it to true when the item is clicked.
Time to code the following:
If the player has the safety item, then go to the next page.
Else: Display the message.
Fade
in a reward or success message once the player enters the lab with their safety gear. Add a few sentences as to why the safety item is important.
Some ideas:
🎨 Add your characters, backgrounds, and props (like objects or decorations).
🎵 Code some music or a voiceover to play!
🕵️ Want to hide your item?
Add a shape and set its opacity (teardrop icon) to 0% to make it invisible. Place it over your item as a "hotspot"—what the player will click. Make sure your code uses the invisible shape, not the item itself.
Create extra pages to hide your safety item. The player will need to explore and find the right page to get ready for the lab!
Interactive Project Example for Students
Play through this lesson's example project created on Elementari. Use this example to guide and motivate your students.
Standards
CSTA K-12 Computer Science Standards (2017)
Algorithms & Programming
2-AP-10 - Use flowcharts and/or pseudocode to address complex problems as algorithms.
2-AP-13 - Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs.
2-AP-17 - Systematically test and refine programs using a range of test cases.
3A-AP-13 - Create prototypes that use algorithms to solve computational problems by leveraging prior student knowledge and personal interests.
3A-AP-16 - Design and iteratively develop computational artifacts for practical intent, personal expression, or to address a societal issue by using events to initiate instructions.
ISTE Student Standards
Creative Communicator
6b - Students create original works or responsibly repurpose or remix digital resources into new creations.
6d - Students publish or present content that customizes the message and medium for their intended audiences.
6c - Students communicate complex ideas clearly and effectively by creating or using a variety of digital objects such as visualizations, models or simulations.
Computational Thinker
5a - Students formulate problem definitions suited for technology-assisted methods such as data analysis, abstract models and algorithmic thinking in exploring and finding solutions.
Innovative Designer
4a - Students know and use a deliberate design process for generating ideas, testing theories, creating innovative artifacts or solving authentic problems.
4d - Students exhibit a tolerance for ambiguity, perseverance and the capacity to work with open-ended problems.
4c - Students develop, test and refine prototypes as part of a cyclical design process.
4b - Students select and use digital tools to plan and manage a design process that considers design constraints and calculated risks.
AASL Standards
Inquire
I.A.2 - Recalling prior and background knowledge as context for new meaning
I.B.3 - Generating products that illustrate learning.
I.C.4 - Sharing products with an authentic audience.