Thrusters: Sprinting in Space (Game Dev Day 33)
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.
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.
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.
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.