Adding thrusters to the space shooter
Now that the game is complete and working, I’m working on adding additional features to really flesh it out. First up, I’m adding functionality for the player to slightly increase their speed on-demand by holding the left shift key.
This is simple enough. I made two variables in the player script: one to hold the boost factor and one that will be referenced to actually multiply the speed.
I’m listening for input on the left shift key in the player’s movement function. When it’s pressed down (GetKeyDown), the boost multiplier will be set equal to the boost factor. When it is released (GetKeyUp), it will set the multiplier back to 1. Then I added the multiplier variable inline with the movement calculations.