Scratch Silver III
Scratch Silver II
SCRATCH SILVER I
SCRATCH GOLD III
1 of 3

4.04 Feed your clones

Now it’s time to feed your animal clones; the player needs to guide them to a food source so they can collect it.

Choose, upload, or draw a sprite to represent the food your animals will eat.

Make the food appear on the screen. It could appear in a random position and at random times. It might move randomly around the screen. Maybe your animals’ food does not move around, but it should scroll with the rest of the scenery.

Adjust the random ranges to change how often the sprite disappears and reappears.

Adjust the random range to change how quickly the sprite moves around the screen.

Add the following code to your sprite to make it scroll left and right as the mouse is moved to either side of the screen.

Test: You need to test your code to make sure the scrolling speed is not too fast or too slow. Also make sure that the sprite leaves and reenters the screen correctly, as the values will be different depending on the size of your sprite.

Now that your animals have something to eat, you can guide them with your mouse-pointer to their food. The question is, what should happen when they reach the food?

Add code so that your animals can eat their food. Eating the food should make it disappear; here are some ideas for what happens next and how it could help your animals.

  1. Generate more clones
  2. Increase the size of your clones
  3. Increase a score

A small addition to your code will make the food disappear when it is touched by a clone.

On your animal sprite, add blocks so that when a clone touches the food sprite, it broadcasts a message.

Then, on the food sprite, hide it when it receives the broadcast.

This code will allow the clones to increase in size each time they eat some food.

This will generate a new clone each time they eat some food.

This will increase a score when some food has been eaten.

×
×

Cart