How long should the PowerUp effect last?

Balance it! But how long? Seconds? Specific shots? Forever?

Timo Schmid
2 min readApr 18, 2021

PowerUps are a different thing. Some of them might provide a divine boost for the player and should be usable for a short amount of time. On the other hand, some PowerUps gives the player a slight enhancement which can be used for a longer time without any issue.

For this example of the just implemented Triple Shot, we will use a time-limit for the usage.

Instantiation Code
Let’s take a look at the code:

Every time we press the Space key and the cooldown timer allows us to shoot, we want to either instantiate the triple laser or the plain, single laser. To check this, we use a bool. After every instantiation, the cooldown will be re-applied.

How the Triple Shot gets activated
As soon as we collect the powerup, we will call the ActivateTripleShot() on the player script. This function will start the TripleShotRoutine() coroutine.

This coroutine will change the bool, which decides the laser to be instantiated. This bool will be set to true for a few seconds (_tripleShotDuration). During this time (in my case 5 seconds), the triple laser will be instantiated. The duration is adjustable and will turn the bool to false after the time limit has been reached which leads to normal shooting again.

You could also limit the triple shot to, for example, 5 shots and then remove the powerup effect.

To figure out the best time limitation (or limitation in general) it’s basically just a matter of trial and error. 5 seconds felt like a good way to go for me, because it’s not too short or too long. The player can definitely feel the impact of the added power.

--

--

Timo Schmid
Timo Schmid

Written by Timo Schmid

The mission? Becoming a game developer! RPG is the dream! Writing down my journey here for me and for everyone interested. Thanks for showing interest :)

No responses yet