Game Development Reference
In-Depth Information
Engage thrusters
We can now modify the script to create varied movement paterns. The basic idea stays the
same. We generate a few clones over ime that move across the screen independently based
on their instrucions.
Let's change the script for the blue enemy sprite to make the clones spread out instead of
following behind each other:
1. Go to the
Scripts
tab of Starfish2.
2. Add a
turn <clockwise>
block to the
repeat
loop, just before the
create clone of
<myself>
block.
3. Take the
pick random () to ()
block, which has the values
-30
and
30
respecively,
out of the
point in direcion ()
block and place it inside the
turn <clockwise>
block.
4. Remove the
+
operator block.
5. Make sure that the direcion the sprite will iniially point to is
-90
degrees
(towards the left side).
6. Change the number of repeats to
3
in the
repeat ()
block.
7. Also change the wait ime before the next clone is created to
0.3
in the
wait () secs
block.
The following screenshot shows the final script: