How Long Should a Powerup Last?

Recently we’ve made a powerup that causes the player to shoot three lasers instead of one. However, we necessarily want the triple shot to stay forever. Sometimes, having too much power can make the game boring!

Shooting three times as many lasers is such a drastic increase in power that having it on permanently could make the game way too easy. This game is supposed to be about deftly moving the ship around and defeating the enemies with precise shots. With three lasers that last forever, then success might instead come specifically from acquiring that powerup once.

That said, having three lasers for a short period of time would be okay, as a way too boost the player’s effectiveness if he’s being overwhelmed. Lets edit the Player script to limit how long the effect of the powerup lasts. Lets add a serialized variable _tripleShotTime and set it to 5 seconds …

… and use it to modify what happens when the player collects a triple shot powerup. The EndTripleShot coroutine will wait 5 seconds and then turn triple shot off.

Now the triple laser effect only lasts a short amount of time after collecting the powerup.

The most important part is that the variable that controls how long it lasts is Serialized, and thus can be edited from the Unity inspector! As we continue adding features to the game, we might later want to change how long this powerup lasts. Perhaps new enemies might make the game more difficult and thus would justify having stronger powerups. We can easily change the time like so:

This ensures that no matter what happens later in the game project, we can quickly edit this value to ensure that the player is properly powerful enough, without even needing to open the script.

I’m a passionate and talented software engineer seeking an opportunity in game development.