Game Development Reference
In-Depth Information
4. We name this sprite
arrow
.
That's all we need to do. We are now ready to script these new sprites.
Engage thrusters
We will first place the bow sprite at a random place in the maze, just like we did with the
sword. Because this is efecively the same sequence of instrucions, we can easily copy the
scripts from
sword
to
bow
:
1. We drag both the
createMaze
and
startGame
listener from the
sword
to the
bow
to
create copies.
2. We just need to change the word to add to the items list from
sword
to
bow
.
With that, the placement of the
bow
item is done. It can now be picked up by the cat. To use
it, we will add scripts to the arrow sprite, which will be the acive part of this weapon.
1.
Drag both the
createMaze
listener and the
() key pressed
script to
arrow
to
make copies.
2.
First, we change the key to be pressed as
a
, for arrow.
3.
Then, we check using the
if <items> contains <bow>
block where
sword
has been
replaced by
bow
.