Creating Modular Powerup Systems in Unity!

Objective: Adding another power up to our game.

We’ll add a new Boolean to our project. This will identify as our speed powerup that I’m adding to my game:

Then create a variable identifying the speed the powerup of our powerup. This will be ‘2’ because we will multiply it by our current speed later on.

In our powerup script, I’ll add the SpeedBoostActive variable to my switch statement.

We will implement this powerup in a method we create called SpeedBoostActive(). Here we are setting the speed boost to true and multiplying our current speed by the variable we made above, speedMultiplier which is set to 2. (2*5 = give us a new speed of 10)

Lastly, I’ll create an cool down for the speed boost that tells the player, after 5 seconds, return to normal speed.

Below you will see that when we collect the speed boost we get a new speed of 10, and after 5 seconds it returns us to our normal speed of 5.

Unity Developer, Software Engineer, Game Designer, Graphic Artist