2D Galaxy Shooter:Simple Thrusters
Here we have done the basic functionality to our 2D Galaxy Shooter, moving forward we will adding new features to it.
Simple Thrusters give us the ability to boost the speed of our 2D Galaxy Shooter Player.
It will be implemented when holding down the left shift key. It will also reset back to normal speed when the ‘Left Shift’ key is released.
We have added the following variables to Player.cs Script Class
Note: Added another variable private bool _isThrusterActive = false;
private float _increasedRate = 5.0f
When update() method is called once per frame on Player.cs script, it will called the CalculateMovement() where we have added logic for the Simple Thruster.
Here when LeftShift Key is pressed -> call ActivateThruster() where it will boost up the speed of the Player and set _isThrusterActive to true.
When LeftShift Key is released -> call DeactivateThruster() where Player move back to normal speed and set _isThrusterActive back to false
Next article we will be adding a Scaling Bar HUD to the UI to limit the use of the thrusters…!!