Coding Conditionals in Scratch

When you code a Scratch project, you sometimes want the sprites to do different things, depending on what is happening in the project.
 
For example, in the Recycle Game in Unit 5, you used an if-then-else block to add 1 to the score if the user moved the item onto the correct Sprite. Else, the project subtracted 1 from the score.
if else block in scratch
The video below helps to explain the different types of conditional blocks, which are blocks that cause different actions depending on a condition.
 
The girl is using a different coding language than Scratch, so the blocks look a little different and have different colors, but the ideas are the same.

Scratch game apps are really fun and can be a great way to educate users about big problems!

ACTIVITY: OCEAN PLASTIC CLEANUP GAME

Follow the video below to make a game where a diver will race against a fish to pick up plastic in the ocean.

This is what the game looks like when finished.

offline video not working – temporary link

GREAT WORK!

You made a Scratch game and learned all about conditional blocks

What ways can you improve or add to the Ocean Plastic Cleanup game?

Try adding one new feature. Here are some suggestions:

  • Test if the diver “wins” the game by getting the health of the fish to 10.  
  • Adding more plastic sprites than just the bottle.
  • Have the plastic bottle “float” through the ocean.
  • Let the fish and the diver move in both directions – right and left.

What else can you add?

Designing and Coding with Scratch

VARIABLES

Before you start coding, let’s learn about variables

There are times you need to keep track of different information inside your Scratch project. That is what variables are for.

You’ll be using variables in the Scratch project you will build in this lesson.

FIRST STEPS

scratch cat

PARTS OF SCRATCH

Click on the arrows on the left and right to learn about the different parts of the Scratch environment.

TIME TO TRY IT!

ACTIVITY 1: CODE THE RECYCLE GAME

Follow the video below to code the Recycle Game, or if you'd rather explore other tutorials, go to the Scratch Ideas page.