
In this article, I’ll review how I added a Triple Shot powerup to my 2D Space Shooter project.
The Triple Shot Powerup
In my 2D Space Shooter, the player normally shoots lasers one at a time to destroy the enemies. More lasers are always fun, so I made a Triple Shot powerup that allows players to shoot three lasers at once!

Collecting the Powerup
First, I created a simple Triple Shot powerup prefab for players to collect to acquire the powerup. This prefab has a Sprite Renderer, Rigidbody2D, and a trigger Box Collider 2D attached to it. I then added a script called PowerupScript, which allows players to interact with the prefab as it falls down the screen.

Implementing the Triple Shot
I created the Triple Shot laser prefab by duplicating and rearranging my existing laser prefab. However, I needed the player’s ship to know when it could actually shoot the Triple Shot lasers.
To do this, in PlayerScript, a script attached to the player’s ship, I created a public method called TurnOnTripleShot(). This function toggles a boolean that controls whether or not the Triple Shot lasers can be fired. So now, in PowerupScript, whenever the player collides with a Triple Shot powerup, it calls TurnOnTripleShot() to turn on the boolean.

Now, players can collect the Triple Shot powerup and shoot 3x the lasers! With Triple Shot included, this Space Shooter game is only just beginning to take shape!