Unity/C# Challenge 23: Adding a Thruster Feature

Alec Oney
Aug 10, 2021

As of now, our player character moves at equal speed around our game, with our movement code appearing as:

covering both normal and speed-boosted speed

To apply an afterburner-esque boost, we are going to first create a boolean and a float variable:

and then modify our movement code to include:

In this case, we modify our movement code to include a variable (_afterBurnerModifier) that is normally 1.0 and therefore does not affect our speed. If we hit left shift, that goes to 1.5, increasing our speed.

Note, while creating a bool was unnecessary to complete this, it was left in as the step will allow us to add more effects to our afterburners down the line.

--

--