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

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.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store