Phase1: Thrusters

Objective: Move the player at an increased rate when the “Left-Shift” key is held down and reset to normal speed when let up.

First, we need to set up some variables. we will need a variable for the current speed, the multiplier for the thruster speed and if the thruster is active or not.


Next, we need to check for the “Left_Shift” key being held down. If the key is down then we set isThrusterActive to true, otherwise, it is false.

Now that we have the variables set and the check for the “Left_Shift” key, we can call our CalculateSpeed method. If the isThrusterActive is true the speed with be multiplied by the thrustMultiplier.

Ok now let's see how this works. Watch the Current Speed change.

Happy Coding!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store