Adding a new feature

Thrusters

James Lafritz
3 min readApr 25, 2021

To implement the thrusters

  • Move the player at an increased rate when the ‘Left Shift’ key is pressed down
  • Reset back to normal speed when the ‘Left Shift’ key is released
  • Activate and Deactivate the thruster visual with the

Looks like I need a new variable for the new speed amount, the speed, and I also need to know if the player has a thrusters visual. I will also have to modify the Set Move Direction method in the Player Behavior. To use the Left Shift Key I will use the Fire 3 from the input manager.

I Check to see if the Fire 3 Button is pressed. If it is:

  • I check to see if Has Thrusters Visual if it does I set the Thrusters Visual to Active.
  • I set the Thruster Speed to Thruster Speed Amount

I check to see if the Fire 3 Button is released. If it is:

  • I check to see if Has Thrusters Visual if it does I set the Thrusters Visual to Not Active.
  • I set the Thruster Speed to Vector2.Zero

I add the Thruster Speed X to the Boost Speed then multiply that amount by the Input on the Horizontal axis.

I add the Thruster Speed Y to the Boost Speed then multiply that amount by the Input on the Vertical axis.

I set the Thruster Game Object in the Inspector on the Player Prefab.

When I run the Game Notice that the Thrusters are displayed.

To Fix this problem I deactivated the thrusters visual in the Start Method after I set the Has Thruster Visual

Changed the Thruster Speed Amount to 4,4 so it is more noticeable in the test.

--

--

James Lafritz

Excited about changing my hobby into a new carer with GameDevHQ course.