Game Development Reference
3. We fill the slots with the built-in direcion variable. This saves the cat's current
direcion to the variable so it can be used elsewhere.
The sword should now funcion properly. Let's play a game to test it. Firstly, we have to move
the cat to the sword to get it. Then we can use the sword with the S key. At each key press,
it should be stuck out in the direcion the cat is facing.
Objective complete - mini debriefing
We have now added a second weapon to the game. We could already use the bomb to
remove enemies, but that poses a danger to the cat because the cat can get hurt by the
explosion as well. The sword doesn't have that problem and it can be used repeatedly a
lot faster. The player has to get very close to an enemy though, so that sill poses a risk.
Another benefit of adding this weapon is that it offers another goal to achieve before
running for the exit. The player has to weigh the benefit of gaining the item versus moving
to the exit straight away. His decision will rely mostly on how many enemies are in the way.
Creating a bow and arrow
As noted, the sword is a very short ranged weapon, which poses a great risk to the player.
If an enemy makes a sudden turn, which the knights do very often, they can easily hit the
player before he/she has a chance to remove the enemy with the sword.
So as an alternaive, we will also create a long range weapon that is much safer to use.
Prepare for lift off
We will create a bow and arrow. This will consist of two separate sprites. We will draw these
1. We select the Paint a new sprite block.
2. We select the brown color and the Ellipse tool.