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.

Anurag Chawla
2 min readMay 26, 2021

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.

Thurster->Speed up Player When Left Shift Key pressed and back to Normal when get 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…!!

--

--

Anurag Chawla
Anurag Chawla

Written by Anurag Chawla

Emerging Technologies - Power Virtual Agents | AI Chatbots | Multi-Cloud & DevOps | UI Technologies - React , Angular | Gaming Technolgies - Unity, XR- AR/VR

No responses yet