Moving the Player at a Faster Speed While the Left Shift Key is Pressed

Objective: Increase “Player Speed when the “Left Shift” key is held down.

To make this magic is the use of the “Input.GetKey” function call. If we use the “Input.GetKeyDown” we only get a TRUE condition for a very brief moment after the key is pressed. “Input.GetKey” stays TRUE as long as we hold the key down.

While holding down the “Left Shift” key we change the value of “_speed” from 4 to 8.

By changing the value of “_speed” we change the speed of our “transform.Translate” functions thus changing the speed of our “Player”…

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