Level Up Your Unity Skills: Implementing Thrusters

Gerald "Ray" Patton
2 min readApr 30, 2024

--

Objective: Develop a means for the Player to boost without a pickup.

As I continue to expand on the design and development of my 2d space shooter, I thought it would be good to add an emergency Thruster to help the Player get out of a tight spot when needed. So the plan is to allow for the Thruster to engage when the Left-Shift is held down and disengage when released. I also want to create it, where both the already created Speed Boost Powerup will stack with the new Thruster.

The first thing every new feature or function within a game needs is a variable. The thruster is no different:

I also created a new method the would use this new variable and the previously created :

This new method will handle both the new Thruster Boost along with the Speed Boost power-up. It will also allow them to stack:

Then some minor changes to the CalculateMovement() method:

As well as, add the functionality of the Left Shift key:

And the final this I needed to do was add the _playerSpeed *= _speedMultiplier function to the SpeedBoostActive() method and _playerSpeed /= _speedMultiplier function to the IEnumerator SpeedBoostPowerDownRoutine():

And a bit of test shows the Left Shift Thruster is working and stacking with the Speed Boost Power up. Until next time, Happy Developing!

--

--

Gerald "Ray" Patton

Unity Developer | C# Software Engineer | Game Developer | USAF Veteran