Today you're going to explore If statements,while creating a Maze Game.
If statements allow the computer to check a condition;decide whether to do something.
If statements have two parts, an If and a Then.
They can be read, 'If this is true, Then do this'.
Take a look at the game Pac-Man as an example.
Pac-Man is a classic arcade game from the 1980s.
In this game, a Pac-Man charactermust avoid a swarm of enemies.
The Pac-Man character uses If statementsin many different ways.
For example, if Pac-Man is touching an enemy,then he looses a life.
In Scratch, you can express the same kindof statement with a Block-Stack.
For example, you could code an If statementthat directs the computer if touching enemy,then change lives by minus one.
Even the maze in Pac-Man uses If statements.
Pac-Man can only move forward if he is not facing a wall.
Today, you'll create a game where players guide a Spritethrough a maze using the mouse.
You'll use If statements multiple times.
For example, if the sprite touches the walls of the maze,then it changes directions or if the sprite touches a bugat the end of the maze, then the game ends.
Check out the different Starter Projectsand decide which one fits the story your game will tell.
(soft music)
To begin, chose one of the starter projectlinks next to this video.
Sign into Scratch.
(upbeat music)
Then click Remix to create and save a copy of the Maze Gamestarter project to your Scratch account.
Now it's your turn.
Open the starter projects and sign in.
Then click Remix to create and save a copy of the Maze Gamestarter project to your Scratch account.
Once you finish these steps, come back to the CS First pageand click the green arrow to move on to the next video.
"Pac-Man - NES Gameplay" by NESguide.com (https://www.youtube.com/watch?v=45j9a6_FiyM) -- Licensed by Creative Commons Attribution 3.0 Unported (https://creativecommons.org/licenses/by/3.0/legalcode) -- Video trimmed to needed length