Powerup Series: Creating Alternate Functionality
Now that Brave the Expanse has some nice-looking assets, let’s add to the base game with powerups! This multi-part series will go over how to add a powerup to your game, step by step.
When you boil it down, a powerup is just an object you collect in-game that temporarily alters or enhances the gameplay. As an example, let’s walk through creating a Triple Shot powerup, where the Player shoots three lasers instead of one.
Creating the Triple Shot object

Using the existing lasers, we can build a Triple Shot object by adding three laser prefabs to an empty game object.

Then, center both the Player object and the Triple Shot object at (0,0,0) and align the lasers where desired on the Player object. For a better-looking TripleShot, make sure the left and right lasers mirror each other on the X axis and share the same Y value. With the lasers aligned within the TripleShot parent object, they will maintain their relative positions. Drag and drop the TripleShot parent object to the Prefabs folder to save the object.
Building the Triple Shot behavior
Since the individual laser movement is already built into the Laser objects within the Triple Shot, the only other change needed is to allow the Player to fire the Triple Shot. To do this:
- The Player needs a reference to the Triple Shot prefab
- The Player needs a indicator for when the Triple Shot should be fired vs. the standard Laser
- The Player needs to instantiate the Triple Shot instead of the standard laser when indicated

To give the Player a reference to the Triple Shot prefab, add a variable in the Player class to hold the reference and add the SerializeField attribute. Then, assign the Triple Shot prefab via the Inspector.

To add an indicator for when to fire the Triple Shot or the standard laser, create a boolean variable. When true, the Player should fire the Triple Shot. When false, the Player should fire the Laser.

Lastly, update the existing FireLaser method to check the Triple Shot Active indicator. If true, instantiate the Triple Shot prefab; otherwise, instantiate the Laser prefab.

Now, if the we check the Triple Shot Active indicator in the Inspector, the player will fire the Triple Shot.
Next up in the Powerup Series, we’ll create and animate a Powerup object!