Determining How Long Powerup Effects Should Last

George Asiedu
Nov 23, 2022

--

When adding power ups to our game it would make sense to add a timer to how long they last for. This can be done through a Co routine.

Collision code

The player collides with power up and on collision the power up is destroyed to give the effect of collection.

The player script has a method to activate an IEnumerator to start a count down of 5 seconds and activate the triple shot

we set the triple shot to false by default in a variable at the start of the script

--

--