Now you’re going to add lots of flying hippos that try to destroy your spaceship.
Create a new sprite with the ‘Hippo1’ image in the Scratch library. Use the shrink tool to make the Hippo
sprite a similar size to the Spaceship
sprite.
Set the
sprite’s rotation style to left-right.Hippo
Add some code to hide the
sprite when the game starts.Hippo
Add some code to the Stage to create a new
clone every few seconds.Hippo
Each new hippo clone should appear at a random x
position, and every clone should have a random speed.
Create a new variable called speed
that is for the
sprite only.Hippo
When you’ve done this correctly, the variable has the name of the sprite next to it, like this:
When each
clone starts, pick a random speed and starting place for it. Then show the clone on the screen.Hippo
Test your code. Does a new hippo appear every few seconds?
At the moment the hippos don’t move.
Each hippo should move around randomly until it gets hit by a lightning bolt. To make that happen, attach this code below the blocks that are already in the
sprite’s code script:Hippo
Test your code again. You should see a new hippo clone appear every few seconds, and each clone should move at a different speed.
Now test the spaceship’s laser cannon. If a lightning bolt hits a hippo, does the hippo vanish?