Welcome to activity 3 of Scratch Games! Today, you will explore if statements while you createa maze game. If statements allow the computer to checka condition and decide whether to do something. If statements have two parts, an IF and aThen. They can be read, “if this is true, then do this.” The game Pacman is a goodexample of how “if” statements work. Pac-man is a classic arcade game from the1980’s. In this game, a character must avoid a swarm of enemies.
The Pac-Man character uses if statements in many different ways. If pac-man is touchingan enemy, then he loses a life. In Scratch, you can createthis kind of statement witha block stack. For example, you could code an if statement that tells the computer, "iftouching enemy, then change lives by minus 1.”
Even the maze in Pac-man uses if statements! Pac-man can only move forward if he is notfacing a wall. In this activity, you will create a game inwhich players use the mouse to guide a sprite through a maze. You’ll use if statementsto complete this project. For example, if the sprite touches the walls of the maze,then it changes direction, or if the sprite touches the bug at the end of the maze, thenthe game ends. Check out the different starter projects,and decide which one fits the story your game will tell.
To begin, choose one of the starter project links next to this video.
Then, click "remix," and sign in to Scratch. Signing in will create and save a copy ofthe Maze Game Starter Project to your Scratch account.
Now it’s your turn: 1. Open and remix one of the starter projects.
2. Sign in.
Once you’ve finished these steps, come back to the CS First page, and click the greenarrow to move on to the next video.