Adding Thruster Feature to the Spaceship

Objective: activate thruster when player presses the shift key

In this challenge we are gonna give the player a speed boost when he presses the left shift key and deactivate the thruster when he releases the key.

We have to create a variable to have the reference to the thruster object (and assign it in the inspector) and another variable to manage the extra speed for the player.

Then we have to add the extra speed variable to the calculate movement function, adding this variable specifically in the transform.Translate speed calculation formula.

Finally we have to check for the left shift key in the update function to activate and deactivate the speed boost and the thruster.

And that’s all! We can activate the extra speed using the shift key.

--

--

--

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Understanding MVVM Architecture in Android

Exploring the Android App Bundle

Adding Limited Ammo To Your Game

8 Steps to Google Pay on Android

Digging into failed redirects within Android Webviews

Mastering Android App Widgets

Integrate Google Maps In Android DialogFragment

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
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

More from Medium

Dynamic Level Loading in Godot

2D Mobile: Setting Up The Player

My personal journey to accessibility bot for news content

Creating a Simple Cooldown System In Unity