An Amazing Maze Game
Experience: 1st year, 2nd quarter
Practice: Creating computational artifacts, Collaborating around computing, Testing and refining computational artifacts, and Communicating about computing
Concept: Algorithms, Control, Modularity, and Program Development
Length: 90+
Overview and Purpose
Coders create a player controlled maze game with multiple, custom levels. The purpose of this project is to introduce conditional statements (if blocks) to create player controls, while reinforcing how to use the image editor to design mazes.
Preparation (20+ minutes)
Suggested preparation
Customizing this project for your class (10+ minutes): Remix the project example to include your own player controlled maze game.
(10+ minutes) Read through each part of this lesson plan and decide which sections the coders you work with might be interested in and capable of engaging with in the amount of time you have with them. If using projects with sound, individual headphones are very helpful.
Download the offline version of Scratch: Although hopefully infrequent, your class might not be able to access Scratch due to Scratch’s servers going down or your school losing internet access. Events like these could completely derail your lesson plans for the day; however, there is an offline version of Scratch that coders could use when Scratch is inaccessible. Click here to download the offline version of Scratch on to each computer a coder uses and click here to learn more by watching a short video.
Resources for learning more
- BootUp Scratch Tips
- Videos and tips on Scratch from our YouTube channel
- Videos and tips on facilitating coding classes from our YouTube channel
- Scratch Starter Cards
- Printable cards with some sample starter code designed for beginners
- ScratchEd
- A Scratch community designed specifically for educators interested in sharing resources and discussing Scratch in education
- Scratch Help
- This includes examples of basic projects and resources to get started
- Scratch Videos
- Introductory videos and tips designed by the makers of Scratch
- Scratch Wiki
- This wiki includes a variety of explanations and tutorials
Getting Started (6-15+ minutes)
Suggested sequence
1. Review and demonstration (2+ minutes):
Begin by asking coders to talk with a neighbor for 30 seconds about something they learned last time; assess for general understanding of the practices and concepts from the previous project.
Explain that today we are going to create a player controlled maze game. Display and demonstrate the sample project (or your own remixed version).
Resources, suggestions, and connections
Practices reinforced:
- Communicating about computing
Video: Project Preview (1:36)
Video: Lesson pacing (1:48)
This can include a full class demonstration or guided exploration in small groups or individually. For small group and individual explorations, you can use the videos and quick reference guides embedded within this lesson, and focus on facilitating 1-on-1 throughout the process.
Example review discussion questions:
- What’s something new you learned last time you coded?
- Is there a new block or word you learned?
- What’s something you want to know more about?
- What’s something you could add or change to your previous project?
- What’s something that was easy/difficult about your previous project?
2. Discuss (3+ minutes):
Have coders talk with each other about how they might create a project like the one demonstrated. If coders are unsure, and the discussion questions aren’t helping, you can model thought processes: “I noticed the sprite moved around, so I think they used a motion block. What motion block(s) might be in the code? What else did you notice?”
After the discussion, coders will begin working on their project as a class, in small groups, or at their own pace.
Practices reinforced:
- Communicating about computing
Note: Discussions might include full class or small groups, or individual responses to discussion prompts. These discussions which ask coders to predict how a project might work, or think through how to create a project, are important aspects of learning to code. Not only does this process help coders think logically and creatively, but it does so without giving away the answer.
Example discussion questions:
- What would we need to know to make something like this in Scratch?
- What kind of blocks might we use?
- What else could you add or change in a project like this?
- What code from our previous projects might we use in a project like this?
- What kind of sprites might we see in a maze?
- What kind of code might they have?
- How could we use a keyboard to control a character?
- How could we switch to a different level when we reach a goal?
- What could happen if we touch a wall?
3. Log in (1-10+ minutes):
If not yet comfortable with logging in, review how to log into Scratch and create a new project.
If coders continue to have difficulty with logging in, you can create cards with a coder’s login information and store it in your desk. This will allow coders to access their account without displaying their login information to others.
Alternative login suggestion: Instead of logging in at the start of class, another approach is to wait until the end of class to log in so coders can immediately begin working on coding; however, coders may need a reminder to save before leaving or they will lose their work.
Why the variable length of time? It depends on comfort with login usernames/passwords and how often coders have signed into Scratch before. Although this process may take longer than desired at the beginning, coders will eventually be able to login within seconds rather than minutes.
What if some coders log in much faster than others? Set a timer for how long everyone has to log in to their account (e.g., 5 minutes). If anyone logs in faster than the time limit, they can open up previous projects and add to them. Your role during this time is to help out those who are having difficulty logging in. Once the timer goes off, everyone stops their process and prepares for the following chunk.
Project Work (85+ minutes; 3+ classes)
Suggested sequence
4. Create levels (25+ minutes, or an entire class)
5+ minute demonstration
Click on the stage icon and open the Backdrops tab. Pick a starting location for our sprite, then demonstrate how to use various drawing tools to create a maze with one color. Think out loud how you want to make sure there is enough room for a sprite to move through the maze without touching a wall.
Draw a “goal” by choosing a new color and drawing with it at the end of the first level (e.g., a square). Ask coders why all of our walls are one color and our goal is a different color. They may realize this makes it easier for users to figure out what the goal is in their level, and it will make it easier to code by allowing us to determine if our sprite touches a wall or a goal.
Quickly demonstrate one more level, but point out you want to have the sprite start in the same location, so don’t put a wall over the starting location.
20+ minutes to create custom levels and 1-on-1 facilitating
Give coders time to create at least three levels using the image editor tools. Encourage peer-to-peer assistance and facilitate 1-on-1 as needed. If coders finish their three levels early, encourage them to add even more, assist others, or walk around to get ideas by looking at other coders’ levels.
Resources, suggestions, and connections
Practices reinforced:
- Testing and refining computational artifacts
- Creating computational artifacts
Video: Create levels (4:38)
Quick Reference Guide: Click here
Video: Image editor: Bitmap mode (5:15)
Video: Image editor: Vector mode (5:00)
Facilitation tip: If you’re not comfortable figuring out how to take into account several wall or goal colors, remind coders for this project they need one color for their walls and one color for their goal. If it’s not the same across every level, it will make coding a little more difficult (but, certainly possible). In addition, encourage coders to keep the same starting location for every level for the same reasons as above. We could have different starting locations for each level, but that makes it more complicated.
Suggested questions:
- Where will you sprite’s starting location be? (make sure it’s the same location for each level)
- Where else might you put your goal?
- Will you make the levels get progressively harder?
- What other shapes could you use to change the way the levels look?
A note on using the “Coder Resources” with your class: Young coders may need a demonstration (and semi-frequent friendly reminders) for how to navigate a browser with multiple tabs. The reason why is because kids will have at least three tabs open while working on a project: 1) a tab for Scratch, 2) a tab for the Coder Resources walkthrough, and 3) a tab for the video/visual walkthrough for each step in the Coder Resources document. Demonstrate how to navigate between these three tabs and point out that coders will close the video/visual walkthrough once they complete that particular step of a project and open a new tab for the next step or extension. Although this may seem obvious for many adults, we recommend doing this demonstration the first time kids use the Coder Resources and as friendly reminders when needed.
5. Create player controls (15+ minutes)
5 demonstration
Choose one of the four options presented in the video (3:49) and quick reference guide, then demonstrate how to create player controls for the sprite that will navigate through the maze. Although we could make the controls more complicated, we only need to make it so our sprite can move up, down, left, and right.
10+ minutes to code their player controls and 1-on-1 facilitating
Leave your code on the screen and give coders time to create or copy their player controls, then test them out to make sure they’re working properly. Encourage peer-to-peer assistance and facilitate 1-on-1 as needed.
Standards reinforced:
- 1B-AP-08 Compare and refine multiple algorithms for the same task and determine which is the most appropriate
- 1B-AP-10 Create programs that include sequences, events, loops, and conditionals
Practices reinforced:
- Testing and refining computational artifacts
- Creating computational artifacts
Concepts reinforced:
- Algorithms
- Control
Video: Create player controls (3:49)
Quick reference guide: Click here
Facilitation tip: Although there are four options presented, the first option would work best for younger coders because it removes the need to understand XY directions. The third option with the forever loop is the best method for responsive player controls, and can be copied by third graders if the code is left on the screen. The fourth option with the or blocks can make things a little complicated for younger coders.
Suggested questions:
- How could you make this maze two players?
- What would you need to change in the code to make it two players?
- What would be similar?
6. Create a restart function (5+ minutes)
2 demonstration
Explain we want to create a restart function that will return Scratch Cat to the starting position when touching a wall or the goal. Review how to use broadcast and receive message blocks to create a function, then discuss how this works great with multiple sprites, but we can use My Blocks when creating a function used by one sprite. Remind the class we need to drag Scratch Cat to the starting position before using our go to block or the X and Y coordinates will be off.
3+ minutes to code their restart function and 1-on-1 facilitating
Leave your code on the screen and give coders time to create or copy their restart function. Encourage peer-to-peer assistance and facilitate 1-on-1 as needed.
Standards reinforced:
- 1B-AP-10 Create programs that include sequences, events, loops, and conditionals
Practices reinforced:
- Testing and refining computational artifacts
- Creating computational artifacts
Concepts reinforced:
- Algorithms
- Control
- Modularity
Video: Create a restart function (2:11)
Quick reference guide: Click here
Note: If you leave your code on the screen for copying, point out their numbers for the go to block might be different than yours.
7. Detect the walls (10+ minutes)
5 demonstration
Explain we want to be able to check to see if our sprite touches a wall. If the sprite touches a wall, it will restart to the starting position. Demonstrate how to do this and make note of how to use the touching color blocks (click on the color, move your mouse to the color you want, click again to save the new color).
5+ minutes to code their project and 1-on-1 facilitating
Leave your code on the screen and give coders time to add the code to their project. Encourage peer-to-peer assistance and facilitate 1-on-1 as needed.
Standards reinforced:
- 1B-AP-10 Create programs that include sequences, events, loops, and conditionals
Practices reinforced:
- Testing and refining computational artifacts
- Creating computational artifacts
Concepts reinforced:
- Algorithms
- Control
Video: Detect the walls (2:36)
Quick reference guide: Click here
Note: If you leave your code on the screen for copying, point out their touching color block will be the color of their walls, not your walls. I know it seems obvious, but this will likely come up with younger coders.
Potential unplugged lesson: You could engage in a discussion or lesson on conditionals (if statements) by working through one of the unplugged lessons on conditionals; for example, Conditionals with Cards.
8. Create a goooooaaaaalllllllll (10+ minutes)
5 discussion and demonstration
Give a minute or two to see if coders can figure out how to use the wall code for our goal.
Explain we want to be able to check to see if our sprite touches our goal so we can switch to the next level. If the sprite touches our goal, it will restart to the starting position and switch to the next backdrop. Demonstrate how to do this and point out the two switch backdrop blocks we need to add (one for switching to the next backdrop when we reach our goal and one for setting our starting backdrop).
5+ minutes to code their project and 1-on-1 facilitating
Leave your code on the screen and give coders time to add the code to their project. Encourage peer-to-peer assistance and facilitate 1-on-1 as needed.
Standards reinforced:
- 1B-AP-10 Create programs that include sequences, events, loops, and conditionals
Practices reinforced:
- Communicating about computing
- Testing and refining computational artifacts
- Creating computational artifacts
Concepts reinforced:
- Algorithms
- Control
Video: Create a goooooaaaaalllllllll (2:03)
Quick reference guide: Click here
Note: If you leave your code on the screen for copying, point out their touching color block will be the color of their goal, not your goal. I know it seems obvious, but this will likely come up with younger coders.
Potential unplugged lesson: You could engage in a discussion or lesson on conditionals (if statements) by working through one of the unplugged lessons on conditionals; for example, Conditionals with Cards.
Advanced Note: We can stack multiple if/else blocks inside the “else” portion of the block to check several possible conditions (each “if” block) and execute one default (the final “else” block). Click here for an example where the text changes depending on how close you are to the goal, and click here to see the code in context.
9. Play test (20+ minutes, or an entire class)
5+ minute play testing
Either in pairs or in small groups, give coders a few minutes to take turns trying out each other’s maze games and discussing how they used code and the image editor tools to create their mazes.
5+ minutes to revise their project and 1-on-1 facilitating
Give coders five or so minutes to revise their projects based on feedback and ideas they gathered from their peers. Encourage peer-to-peer assistance and facilitate 1-on-1 as needed.
I recommend repeating this process several more times to encourage sharing ideas and getting peer feedback
Standards reinforced:
- 1B-AP-10 Create programs that include sequences, events, loops, and conditionals
- 1B-AP-13 Use an iterative process to plan the development of a program by including others' perspectives and considering user preferences
- 1B-AP-16 Take on varying roles, with teacher guidance, when collaborating with peers during the design, implementation, and review stages of program development
Practices reinforced:
- Collaborating around computing
- Communicating about computing
- Testing and refining computational artifacts
- Creating computational artifacts
Concepts reinforced:
- Algorithms
- Control
Facilitation tip: It may help to model the kind of feedback one might give to a game like this. To practice this, display the maze I created for this lesson or one of the mazes I previously created in this studio. Ask coders what’s something they like about the project, what they might be curious about, and what suggestions they might have for improving the project(s).
Note: When testing out specific levels, a quick way to get to the desired level is to use code to switch to the specific backdrop when the green flag is clicked.
10. Add in comments (the amount of time depends on typing speed and amount of code):
1 minute demonstration
When the project is nearing completion, bring up some code for the project and ask coders to explain to a neighbor how the code is going to work. Review how we can use comments in our program to add in explanations for code, so others can understand how our programs work.
Quickly review how to add in comments.
Commenting time
Ask coders to add in comments explaining the code throughout their project. Encourage coders to write clear and concise comments, and ask for clarification or elaboration when needed.
Standards reinforced:
- 1B-AP-17 Describe choices made during program development using code comments, presentations, and demonstrations
Practices reinforced:
- Communicating about computing
Concepts reinforced:
- Algorithms
Video: Add in comments (1:45)
Quick reference guide: Click here
Facilitation suggestion: One way to check for clarity of comments is to have a coder read out loud their comment and ask another coder to recreate their comment using code blocks. This may be a fun challenge for those who type fast while others are completing their comments.
Assessment
Standards reinforced:
- 1B-AP-17 Describe choices made during program development using code comments, presentations, and demonstrations
Practices reinforced:
- Communicating about computing
Although opportunities for assessment in three different forms are embedded throughout each lesson, this page provides resources for assessing both processes and products. If you would like some example questions for assessing this project, see below:
Summative (Assessment of Learning)
The debugging exercises, commenting on code, and projects themselves can all be forms of summative assessment if a criteria is developed for each project or there are “correct” ways of solving, describing, or creating.
For example, ask the following after a project:
- Can coders debug the debugging exercises?
- Did coders create a project similar to the project preview?
- Note: The project preview and sample projects are not representative of what all grade levels should seek to emulate. They are meant to generate ideas, but expectations should be scaled to match the experience levels of the coders you are working with.
- Did coders use a variety of block types in their algorithms and can they explain how they work together for specific purposes?
- Did coders include descriptive comments for each event in all of their sprites?
- Can coders explain how else they might use an “if” conditional block?
- Can coders explain the different affordances and constraints of the various ways for creating user controls?
- Did coders create a maze game with at at least ## different levels and player controls for the character?
- Choose a number appropriate for the coders you work with and the amount of time available.
Formative (Assessment for Learning)
The 1-on-1 facilitating during each project is a form of formative assessment because the primary role of the facilitator is to ask questions to guide understanding; storyboarding can be another form of formative assessment.
For example, ask the following while coders are working on a project:
- What are three different ways you could change that sprite’s algorithm?
- What happens if we change the order of these blocks?
- What could you add or change to this code and what do you think would happen?
- How might you use code like this in everyday life?
- See the suggested questions throughout the lesson and the assessment examples for more questions.
Ipsative (Assessment as Learning)
The reflection and sharing section at the end of each lesson can be a form of ipsative assessment when coders are encouraged to reflect on both current and prior understandings of concepts and practices.
For example, ask the following after a project:
- How is this project similar or different from previous projects?
- What new code or tools were you able to add to this project that you haven’t used before?
- How can you use what you learned today in future projects?
- What questions do you have about coding that you could explore next time?
- See the reflection questions at the end for more suggestions.