Added health and stamina

This commit is contained in:
Sasha Koshka
2023-02-21 18:53:19 -05:00
parent ddb960571f
commit 29e4a7572b
3 changed files with 80 additions and 6 deletions

View File

@@ -16,6 +16,7 @@ type ControlState struct {
StrafeRight bool
LookLeft bool
LookRight bool
Sprint bool
}
type Raycaster struct {
@@ -81,6 +82,7 @@ func (element *Raycaster) HandleKeyDown (key input.Key, modifiers input.Modifier
case 'd', 'D': element.controlState.StrafeRight = true
case 'w', 'W': element.controlState.WalkForward = true
case 's', 'S': element.controlState.WalkBackward = true
case input.KeyLeftControl: element.controlState.Sprint = true
default: return
}
@@ -97,6 +99,7 @@ func (element *Raycaster) HandleKeyUp(key input.Key, modifiers input.Modifiers)
case 'd', 'D': element.controlState.StrafeRight = false
case 'w', 'W': element.controlState.WalkForward = false
case 's', 'S': element.controlState.WalkBackward = false
case input.KeyLeftControl: element.controlState.Sprint = false
default: return
}