1 of 16

Virtual Pet �Cards

Create an interactive pet that can eat, drink, and play.

scratch.mit.edu

Set of 7 cards

2 of 16

Virtual Pet Cards

Use these cards in this order:

  • Introduce Your Pet
  • Animate Your Pet
  • Feed Your Pet
  • Give Your Pet a Drink
  • What Will Your Pet Say?
  • Time to Play
  • How Hungry?

scratch.mit.edu

Set of 7 cards

3 of 16

Introduce Your Pet

Virtual Pet

1

Choose a pet and have it say hello.

4 of 16

Introduce Your Pet

scratch.mit.edu

GET READY

ADD THIS CODE

Drag your pet to where you want it on the Stage.

Choose a sprite to be your pet, like Monkey.

Choose a backdrop, like Garden Rock.

Garden

Monkey

Monkey

Set its position. (Your numbers may be different.)

Type what you want your pet to say.

TRY IT

Scroll over sprites in the Sprite Library to see their different costumes.

Pick a sprite with more than one costume.

Click the green flag to start.

5 of 16

Animate Your Pet

Virtual Pet

2

Bring your pet to life.

6 of 16

Animate Your Pet

GET READY

Choose a costume.

Choose a different costume.

TRY IT

Click the Costumes tab to see your pet’s costumes.

ADD THIS CODE

Monkey

Click the Code tab and add this code.

Click your pet.

scratch.mit.edu

7 of 16

Feed Your Pet

Virtual Pet

3

Click the food to feed your pet.

8 of 16

Feed Your Pet

scratch.mit.edu

GET READY

Broadcast the food message.

Select New message

and name it food.

Select your pet.

Glide to the starting position.

Choose a sound from the Sounds Library, like Chomp.

Click the Sounds tab.

Choose a food sprite, like Bananas.

ADD THIS CODE

Bananas

Monkey

Bananas

Monkey

Choose food from the menu.

Choose Bananas from the menu.

TRY IT

Click the food.

Click the code tab.

9 of 16

Give Your Pet a Drink

Virtual Pet

4

Give your pet some water to drink.

10 of 16

Give Your Pet a Drink

scratch.mit.edu

ADD THIS CODE

Switch to the empty glass.

Click the drink to start.

GET READY

Monkey

Glass Water

Broadcast a new message.

Glass Water

Choose drink from the menu.

Choose Glass Water from the menu.

Glide to the starting position.

Tell your pet what to do when it receives the message.

Switch to the full glass.

TRY IT

Choose a drink sprite, like Glass.

11 of 16

What Will Your Pet Say?

Virtual Pet

5

Let your pet choose what it will say.

12 of 16

What Will Your Pet Say?

scratch.mit.edu

ADD THIS CODE

Type things for your pet to say.

Insert the pick random block.

Click your pet to see what it says.

GET READY

Name this variable Choice

and then click OK.

Choose Variables.

Click the Make a Variable button.

Choice

Monkey

Insert the Choice block into the equals block from the Operators category.

TRY IT

13 of 16

Time to Play

Virtual Pet

6

Have your pet play with a ball.

14 of 16

Time to Play

scratch.mit.edu

ADD THIS CODE

TRY IT

Type a minus sign to make the ball move down.

GET READY

Choose a sprite,� like Ball.

Ball

Monkey

Ball

Insert the touching block into the wait until block.

Broadcast a new message.

A positive number makes the ball move up.

Pick Ball from the menu.

Choose Monkey from the menu.

Choose play from the menu.

Click the ball.

15 of 16

How Hungry?

7

Keep track of how hungry your pet is.

Virtual Pet

16 of 16

How Hungry?

scratch.mit.edu

GET READY

ADD THIS CODE

TRY IT

Increase hunger level every 5 seconds.

Reset hunger level.

Name this variable Hunger

and then click OK.

Choose Variables.

Click the Make a Variable button.

Hunger

Then click the food.

Click the green flag to start.

Monkey

Type a minus sign to make your pet less hungry when it gets food.

Choose food from the menu.