Game Development Reference
In-Depth Information
7. If
power_boost_on
is
false
, the ammo would move up repeatedly unil it hits
either an enemy or the ceiling. In other words,
change y by (<speed> * <frame_
rate>)
and
repeat unil (<y posiion> greater than (180) or touching <Rock>? or
touching <Robot > ? or touching <Monster>?
or touching <Mother Ship>?
.
8. Ater hiing the ceiling or an enemy, delete the clone using
delete this clone
.
The final script should look like the following screenshot:
If the game is over, each clone will delete itself. Add the
when I receive <game_over>
and
delete this clone
blocks.
Next, let's add the scripts for the Enemy Ammo sprite:
1. When the game starts, don't show the sprite. Wait for the creaion of the clone.
Then, add the
when green flag is clicked
and
hide
blocks.
2.
Now let's add the script for a clone. Start with
when I start as a clone
.
3.
Add the
switch costume to <game_level>
block.
4.
Add the
go to x: (pick random () to ()) y: ()
block; fill in the values
-240
and
240
for
x and
180
for y. Then, add the
go to front
and
show
blocks.