-- PROJECTILES --
A lot of people have asked how to implement projectiles (ie. arrows, fireballs, random magic glowing balls, ect.) into their games. Well I'm going to teach you how to implement these into your game. My tutorials will be broken down into: Uses for topic, game items needed to create, steps to create.
USES FOR TOPIC
1. Make more of a Zelda type game.
2. Shoot something at player and damage them if it hits them.
3. Player shoots something at (name something) and it does (name something).
GAME ITEMS NEEDED
1. One common event.
2. Projectile event (one on every map if you want it to be something the player can shoot anywhere and the event has to be the same number on each map)
3. In case of a pillar that shoots arrows at player you will need to have one parallel process event that controls timing on the map.
4. Four variables one for the X position of the projectile and one for the Y position of the projectile one for the X position of the player and one for the Y position of the player. If the player is shooting it then an X position of the enemy and Y position of the enemy.
5. Event picture of projectile.
STEPS TO CREATE
1. Make a common event that will control damage. The status of the event should be "none" and obviously there is no switch. In this event do something like impact sound, flash screen red (or something), decrease HP (entire party usually) by whatever you want, exit event processing.
2. One each map place an event that will be used for the projectile. You do not need to give it a picture yet if it's something the player will be shooting. If its a projectile that something is shooting on the map you should give it a picture and select direction fix AND through. If the projectile is being shot by the player its important the the event is the SAME number throughout every map. I usually just place it as the first event on every map and in the corner of the screen or something. If its a projectile that fires from a pillar or something place the event at the location from which it fires.
IMPORTANT -- In either projectile type you will need in the event a parallel process that sets a variable to the X position of the projectile and another variable to the Y position. Directly after this you will need a conditional branch that says if Projectile X equals Player X and then inside that branch another that says if Projectile Y equals Player Y. Inside these branches put call event process and the process will be whatever process you chose for your damage calculation.
If you have more than one projectile you can don't need more variables!!! That's right! Most people don't know this but if you set variable coordinates inside an event to that event's position and then set in another event the same variables to the new event's position the game will use BOTH coordinates for the position. So inside 4 different projectiles you can set the same Projectile X and Y positions and run into them and it will damage you no matter which one you hit!
3. If the projectile is being shot by something in a room at the player you will need a parallel process event that controls the timing of when it fires. In this event you can give it one specific "wait" time or a random time with more elaborate eventing which I won't discuss at this time (maybe later). First thing in the event is a wait command of however many seconds you want. next you'll play a fire sound such as a bow shot or fire sound for a fireball. Finally set move route for projectile to move in whatever direction needed as far as you want it to move. At the end of the event put a set event location (of projectile) back to place it fired from and "Exit Event Processing."
4. The variable have already been discussed but you'll need two for the projectile (one for X position and one for Y) and two variables that determine the player X and Y. If you have the player shooting an arrow at enemies have and X and Y position for enemies too.
5. Find (or make yourself) pictures for the projectile arrow fireball ect.
This should get you started using projectiles. If you are good at eventing you can fire the projectile from a bad dude or from the player. I'll teach you how to do both of these in a later lesson.
That's it for now! Happy gaming!