Animal Classification Game

This is a tutorial on how to make an Animal Classification game in Scratch. This is a very simple version — So try adding onto it! Can you do 8 animals? 12?

Setting the game up
First thing you’re going to want to do is make 4 sprites — one for each animal you want them to choose from. I chose a cat, bat, penguin, and mouse.

Next, you’ll want to edit your background to include directions. I did this by clicking on my stage and editing the current background (next to Scripts, called Backdrop) and clicking on the T (for text). I wrote out “Choose one of these listed animals,” and then put the name of each animal.

Once done, your scratch should look like this:
Screen Shot 2017-07-20 at 2.44.28 PM

Programming the game
Click on Sprite1 — This is where we will be writing our entire script. First, we will want to tell our program when to start. I chose when green flag clicked from Events.

Since we already put the directions in the background, we are ready to start asking our questions! I want to first separate out my winged animals from my non-winged animals, so I’m going to drag over an ask ‘what’s your name?’ and wait from Sensing, replacing ‘what’s your name?’ with ‘Does your animal have wings?’. The logic: IF they answer ‘yes’, THEN it narrows it down to the bat or the penguin. IF they answer ‘no’, it leaves the cat and the mouse. So the first thing we are going to want to grab is the IF/THEN/ELSE from Control and drag it under our first question.

Let’s first figure out the IF part. IF answer = ‘yes’ then… So let’s put in a ‘ ‘ = ‘ ‘ from Operators, filling the first blank box in with answer from Sensing, and typing in ‘yes’ into the second blank box. If they chose a winged animal, we now want to find out if its the bat or the penguin. I’m going to put inside the if/then another ask and wait from S

ensing, with the question ‘Is your animal nocturnal?’. Here we will add another IF/THEN/ELSE from Control (keep in mind this is inside our other if statement) and fill it in with answer = ‘yes’ again.

At this point, we can identify two of the animals! IF they answered ‘yes’ to their animal being nocturnal we are going to say ‘Your animal is a bat!’ from Looks. Under the ELSE in that same second IF statement we are going to put say ‘Your animal is a penguin!’ from Looks. Your code should now look like the following:

Screen Shot 2017-07-20 at 2.49.58 PM

Moving back to our first else, remember that it has now been narrowed down to the cat or the mouse. I’m going to use an ask and wait from Sensing and ask the question ‘Does your animal have pointed ears?’. Just like with the bat and penguin, I’m going to go to Control and put in another IF/ELSE/THEN statement. IF answer = ‘yes’ THEN… we are going to go to Looks and say ‘Your animal is a cat!’. Under ELSE, we are going to say ‘Your animal is a mouse!’. Your final code should look like the below.

Screen Shot 2017-07-20 at 2.53.49 PM

How can we make this more challenging? What other animals can we add? Post in the comments any questions you might have!

Advertisements

2 thoughts on “Animal Classification Game

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s