Virtual Pet �Cards
Create an interactive pet that can eat, drink, and play.
scratch.mit.edu
Set of 7 cards
Virtual Pet Cards
Use these cards in this order:
scratch.mit.edu
Set of 7 cards
Introduce Your Pet
Virtual Pet
1
Choose a pet and have it say hello.
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.
Animate Your Pet
Virtual Pet
2
Bring your pet to life.
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
Feed Your Pet
Virtual Pet
3
Click the food to feed your pet.
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.
Give Your Pet a Drink
Virtual Pet
4
Give your pet some water to drink.
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.
What Will Your Pet Say?
Virtual Pet
5
Let your pet choose what it will say.
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
Time to Play
Virtual Pet
6
Have your pet play with a ball.
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.
How Hungry?
7
Keep track of how hungry your pet is.
Virtual Pet
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.