Thursday, October 8, 2015

Homework 5

Most platforming games have some sort of sprinting ability so I created that as well as a stamina system that depletes with sprinting. To sprint all that is required of the player is to press the left shift and the player will move at 2x the normal max walk speed. Shown below is a short gif of this in action. I also will note there is string being printed out in the top left showing how much stamina is available, this will of course be later changed to represent a stamina bar in future versions.


The first blueprint I made was a simple sprint mechanic. Whenever the action to sprint is detected the Boolean IsSprinting will be set to true (otherwise will be false) and the max walk speed is set to the variable sprint speed (2x the walk speed) this is then returned to the character movement. When the sprint button is released the IsSprinting Boolean is set to false and normal walk speed is set.

 

Next is the blueprint dealing with stamina. It starts every event tick and determines whether or not the character is currently sprinting, if sprinting is detected then stamina decay sets in, decreasing the amount of the variable Stamina. If no sprinting is detected then stamina recovery kicks in increasing the amount of the Stamina variable. After Stamina is set a branch checks to see if Stamina is equal to 0 and if not then the player can keep sprinting. If Stamina is equal to 0 then the player can no longer sprint and the max walk speed is set back to the value of the variable walk speed. The print string function at the bottom is how Stamina's value is printed out on screen. As stated earlier this will be replaced by a stamina bar.




No comments:

Post a Comment