Thrusters: Sprinting in Space (Game Dev Day 33)

Jack Leavey
2 min readSep 19, 2021

Objective: Allow the player to move twice as fast when holding down the “Left Shift” key.

In our overall goal of refining and implementing engaging mechanics for our players, movement is going to be primary focus. Movement has to feel satisfying in any video game (this is why water levels are usually disliked).

Let’s look at our spaceship’s movement speed (5) in game.

Baseline Movement Speed of 5

It works, but maneuvering around multiple enemies and projectiles is going to be difficult. While as do have a powerup that increases speed by 60%, it is not allows available.

Fortunately, implementing the ability to speed up in game is trivial.

Let’s look at the code we need.

This is located in void Update.

In layman’s terms, we are just doubling the movement speed when we press down on the Shift key, and then halving it when we let go of the Shift key, resetting it to its original value (5). I made sure to include our Boosted Speed variable that we get when collecting the “Speed” powerup.

Let’s look at the difference in game.

It is now possible to strafe rapidly when holding down shift.

This simple mechanic will give players more control over their engagements. As we continue to add more mechanics (for our player AND our enemies) it will be vital to balance this speed stat for smooth gameplay.

--

--

Jack Leavey

I am a software engineer with years of experience branching into game development, specifically in Unity. Follow along for guides on creating game mechanics!