Determining How Long Powerup Effects Should Last- Game Dev Series 17

S.J. Jason Liu
May 12, 2021

Objective: Make the triple shot powerup each time would only last for 5 seconds.

Previous: Make an Animation with Sprites

Every powerup or buff should has a limit. Since we have a bool to switch between 1 shot & 3 shot, we can easily create this limit in code.

Open the Player script and add an IEnumerator. Within this coroutine function, we will switch the bool to false after 5 second when active.

Then add a StartCoroutine callup in TripleShotActive().

Then it should work! We can Play it to check the result.

--

--

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.