Adding Thruster Feature to the Spaceship

Make player faster

Rusben Guzman
Jul 19, 2021

Objective: activate thruster when player presses the shift key

In this challenge we are gonna give the player a speed boost when he presses the left shift key and deactivate the thruster when he releases the key.

We have to create a variable to have the reference to the thruster object (and assign it in the inspector) and another variable to manage the extra speed for the player.

Then we have to add the extra speed variable to the calculate movement function, adding this variable specifically in the transform.Translate speed calculation formula.

Finally we have to check for the left shift key in the update function to activate and deactivate the speed boost and the thruster.

And that’s all! We can activate the extra speed using the shift key.

--

--

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.