Giving Your Player More Thruster Power

Daniel Jennings
2 min readAug 6, 2021

Because Thrusters are not enough

Task:

Give your player the ability to go faster while they are pressing the Left-Shift key.

Plan:

Sounds like we need to listen for a key press. If we detect that key press we need to add in a multiplier to adjust the speed at which the ship is moving in each direction.

Confession:

Better late than never. In my original design I adjusted the forward movement to be slower than the backwards movement. This was based on the assumption that the Player was already moving forwards at some velocity so moving forwards would take them a little longer than turning off their thrusters.

Process:

Since this is a player specific adjustment we should add the key check directly to the Player.

Start by creating a class variable to holder the thrust modifier.

Let’s create a method to hold the Thruster logic. This will adjust the modifier based on keys pressed or released. To clarify, Input.GetKeyUp is called once during the frame that the key is released.

And then add it to the movement method.

Now that is a burst of thrust!!

--

--