Creating a Negative Pickup to Slow Down the Player
Make player move like a turtle
Objective: create a negative powerup to make the player slower for 10 seconds
In this game I am using the same sprite and animation for all negative powerups. So the first step was to duplicate the hacked movement prefab, change the name and assign a new powerup ID.
In the player script I create a coroutine to change the speed of the player, wait 10 seconds and assign the original speed. Also created a public function to start the coroutine.
In the powerup script I added a new case to call the slow down function of the player.
In the unity editor I selected the spawn manager object and added the slow down prefab to the powerups array.
And good to go!!! Now the player loses speed when collects the new powerup.