Move exaust and regen speeds to the top of the script

This commit is contained in:
2024-03-29 19:58:11 -07:00
parent 9fbb23aa7a
commit 97eae9c686

View File

@ -19,6 +19,8 @@ var status = {
"health": 100, "health": 100,
"stamina": 100, "stamina": 100,
"exausted": false, "exausted": false,
"exaust_speed": 1,
"stamina_regen_speed": 0.5,
"level": 1 "level": 1
} }
var current_tool = "none" var current_tool = "none"
@ -57,13 +59,13 @@ func _process(_delta):
if is_sprinting: if is_sprinting:
speed = sprint_speed speed = sprint_speed
status.stamina -= 1 status.stamina -= status.exaust_speed
if status.stamina <= 0: if status.stamina <= 0:
is_sprinting = false is_sprinting = false
status.exausted = true status.exausted = true
else: else:
if status.stamina < 100: if status.stamina < 100:
status.stamina += 0.5 status.stamina += status.stamina_regen_speed
if status.exausted: if status.exausted:
speed = exausted_speed speed = exausted_speed
else: else: