Implementing Speed Boost Powerup in Unity

Make the player faster when collect a powerup

Rusben Guzman
2 min readJun 7, 2021

Objective: Create an script to make the player move faster when collect the speed boost powerup

In this challenge I’m gonna show you how to modify the player speed when collecting the powerup. So the first step is to declare some variables to have control of the speed in each moment of the game.

Then we have to create a coroutine to modify the value of the speed, wait 5 seconds and set the speed as default again and create a public function to start the coroutine.

After that in the powerup script in the OnTriggerEnter we have to check if the powerupID is equal to the speed boost id (1 == Speed Boost) and call the function to activate the powerup.

Now we can run the game and see how the player moves faster when picking up the powerup.

--

--

Rusben Guzman
Rusben Guzman

Written by Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

No responses yet