I don't have a character sprite sheet for using a bow weapon, so I'll only demonstrate the arrow being shot from the player. We'll do the following: When the player presses A, we'll spawn an event named "Arrow" from the template map at the player's position. This will only happen if the player has an Arrow item in their inventory.
Now, let's create the Arrow event in the template map.
We'll continue using the notetag <weaponAttack> from the previous tutorial. Then, we'll create a Movement Route with the following commands:
- setMoveSpeed: To make the arrow travel faster.
- shareDirection('player'): To align the arrow's direction with that of the player.
- Change the graphic to an arrow and make it move forward.
- After moving 7 steps, the arrow will destroy itself.
Demonstration:
1. Event is newly spawned. All events when created initially has direction Down
2. Match the direction of the event to be the same as player
3. Change graphic of the event to Arrow (I don't have one so I use Actor1)
4. Make the event move forward
Let's create a new common event. When this event (the arrow) collides with any event tagged with the <enemy> notetag, it will destroy itself immediately.