Game Development Reference
5. Now add set speed to (pick random () to ()) ; fill in the values 10 and 15 .
6. The effect of repeatedly falling down or moving straight down on the y axis is
brought using repeat unil ((y posiion < -180) or (touching <Spaceship>)) and
change y by ((-1) * (speed * frame_rate)).
7. Ater geing out of the repeat () loop , this ammo clone has either touched the stage
botom or the Spaceship. Add if touching Spaceship and then broadcast ship_hit .
Finally, delete the clone using delete this clone .
Besides hiing the botom or the Spaceship, an Enemy Ammo clone is also deleted when the
current level completes. Add when I receive <level_up> and delete this clone . The finished
script looks like the following screenshot:
Objective complete - mini debriefing
We inished creaing the scripts for Spaceship Ammo as well as for Enemy Ammo. Now you
can test each script by double-clicking on the script. If you double-click on the when I start
as a clone block once, one Spaceship Ammo clone will show at the botom and lies straight
up unil it hits the top. For Enemy Ammo, the clones will show at the top and fall down unil
it hits the botom or a Spaceship sprite.