Determining the duration of powerup effects on Player
Any game is incomplete without additional power that gets bestowed upon a gamer by collecting abstract artifacts.
They can be symbolic game objects that push extra strength for a certain amount of time while one plays against enemies.
It is worth noting that their interaction solely happens with the player.
In the scenario of giving a life limit to such a booster, a developer must adhere to the gamers’ tendencies toward excitement and timing. The boost shall sustain for a very limited window so that the gamer gets on tows for optimum use and at the same time, it must arrive at a juncture when the gamer is about to see a defeat.
In the case of the game below, there are three distinct powers to be collected. A triple bullet shot, a speed multiplier, and a shield that saves a life.
Based on my understanding so far, a duration for all of them turned out to be oscillating roughly in between 3 to 7 seconds considering that the enemy spawning is occurring at 5-second intervals.
A simple implementation using a coroutine is as followed.
Thank you very much