Allow for custom footsteps. Some work on footsteps to make the sound less crazy. Various other updates. Added initial documentation and credits files.

This commit is contained in:
Storm Dragon
2025-02-05 02:04:57 -05:00
parent 883dafaac0
commit c29bcd40b7
17 changed files with 431 additions and 43 deletions

View File

@@ -23,6 +23,14 @@ class Player:
self.distanceSinceLastStep = 0
self.stepDistance = 0.5
self.stats = StatTracker()
self.sounds = sounds
# Footstep tracking
self.distanceSinceLastStep = 0
self.stepDistance = 0.8
self.lastStepTime = 0
self.minStepInterval = 250 # Minimum milliseconds between steps
self.footstepSound = "footstep"
# Inventory system
self.inventory = []
@@ -51,6 +59,11 @@ class Player:
attackDuration=200 # 200ms attack duration
))
def should_play_footstep(self, currentTime):
"""Check if it's time to play a footstep sound"""
return (self.distanceSinceLastStep >= self.stepDistance and
currentTime - self.lastStepTime >= self.minStepInterval)
def update(self, currentTime):
"""Update player state"""
# Check if invincibility has expired
@@ -91,6 +104,10 @@ class Player:
"""Get current max health"""
return self._maxHealth
def set_footstep_sound(self, soundName):
"""Set the current footstep sound"""
self.footstepSound = soundName
def set_health(self, value):
"""Set health and handle death if needed."""
if self.isInvincible: