Game Development Reference
In-Depth Information
4.
Press
OK
to add
Ghost2
to the game.
Engage thrusters
Structurally, the scripts for the ghost will be the same as those for the knight and the cat.
However, it doesn't need the
takeStep
funcion, because the ghost can just move all over
the place.
1. We can first copy the
createMaze
listener script and the
startGame
listener script
from
Knight
. This will shrink the ghost to the right size for the maze and also sets up
where it should be placed.
2.
Then, we only need to remove the two
add () to xySave
blocks, because the ghost
doesn't require them. Other than that, these two scripts will be exactly the same as
for the knight.
So we can quickly move on to creaing the clone script.
1. We start again with a
when I start as a clone
block.
2. Then, we first show the sprite again using the
show
block
3.
Next, we use the
point in direcion ()
block to determine which way the ghost
will move.