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:
@@ -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:
|
||||
|
Reference in New Issue
Block a user