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

Twitter Spinner — Flutter

Trend Micro CTF 2020 — Keybox writeup

Android App Lets You Code with CircuitPython Boards Using Your Phone

Effective Coroutine Flow

Android UI testing for beginners

State management

Design Patterns in Android with Kotlin

Improve code quality with ktlint, detekt, and git hooks

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

We all start somewhere

Score Implementation

Simple 2D Player Movement In Unity: Ideal For SHMUPs

Installing Unity