Game Development Reference
In-Depth Information
The completed script will look like the following screenshot:
Remember how we already placed a
delete this clone
block at the end of the
createMaze
script? That was to remove any clones that will be created with this script during a game.
We are now ready to write a script to move the clones.
1. We obviously begin a new script with
when I start as a clone
.
2. Then, we show the sprite using the
show
block.
3. We add a
repeat unil
loop.
4. There we check whether the clone is
touching <explosion>?
5. Unil that's the case, we turn in a random direcion with a
turn <clockwise> ()
degrees
block.
6. We limit the clone to the cardinal direcions by entering
90
,
0
, and
3
respecively in
the
() * pick random () to ()
block.
7.
Then, we call the
takeStep
funcion to actually move the clone.