Shooting Projectiles
Big Picture:
Big Picture:
There are many ways to shoot a projectile in Unity. Most of the time you will need to resolve these questions:
- What command or button is doing the firing?
- What other limitations are there on the firing? Such as limited ammo, delay between shots, etc
- Make a prefab bullet
- Bullet starting position, rotation and direction it will move
- How will the bullet move? With a rigidbody?
Some Great Resources:
Some Great Resources:
"2D Shooting in Unity (Tutorial)" (21min, Sep 2018) by Brackeys. A super good overview of shooting projectiles in 2D.
"How to Make a Homing Missile" (9min, Oct 2017) by Brackeys.
"How to Make a 2D Ranged Combat System" (11min, Aug 2018) by BlackThornProd. A video of how to rotate a 2D gun to face in the direction of the mouse cursor, so it can shoot in that direction.