top of page
Search

Creating the Sprint

  • Abbie Hipwell
  • Jan 19, 2022
  • 2 min read

Updated: Jun 14, 2022


After coding and testing the stamina mechanic, it was time to start working on the sprint. I waited until the stamina was done first as sprint relies on stamina in our game.

I have to be careful not to code the sprint to be too fast, as this will make aiming and shooting impossible to do successfully - increasing players frustration at the game. This will mean that I will carry out lots of testing to see what I, and my group, thinks is best.


Before starting the mechanic, I spoke with the group about how exactly the sprint should work - do we want the player to sprint in all directions, or just forwards? We decided that we wanted to limit the sprint to forwards only, this is to encourage them to sprint forwards to run towards ammo, and to primarily use the dash for strafing left or right.


I have set up the key binding for sprint as an action mapping, 'left shift' and 'gamepad left trigger' can both be used to for this.



If any input actions for sprint are pressed, the branch node will check whether the stamina is above zero, if this is False, the player cannot sprint. If this is True, the next branch node will check whether either of the input keys, 'w' or 'gamepad left thumbstick up' are being used. If this is then also true, the Boolean variable isSprinting will be set to True, the players walk speed will then be set to 1000.


Once this input is released, isSprinting? will be set back to False, and the players walk speed will remain the same.


The code for this can be seen below:



The sprint mechanic will allow for faster gameplay, the player will be able to run to collect ammo a lot easier. This combined with the dash mechanic will make each match more fast-paced.


This mechanic was a lot easier than the stamina mechanic to code; this is mostly because it relied on the stamina to work. This code was made to be as optimised as possible, and I was able to do it with a limited number of nodes - the use of input action mappings was especially useful in optimising this.


I'm glad that the sprint mechanic is now in the game, this has instantly sped up the gameplay and created a more fun experience for the player, this combined with the dash will make the movement mechanics feel like any other game they have played.

 
 
 

Comments


bottom of page