Fixed item crazy sound mismatch. Updated instructions, probably not final version, but at least a place holder.

This commit is contained in:
Storm Dragon
2025-02-11 20:23:39 -05:00
parent 7f68af1958
commit 8530993fa9
3 changed files with 35 additions and 15 deletions

View File

@@ -12,33 +12,38 @@ class PowerUp(Object):
)
self.sounds = sounds
self.direction = direction
self.speed = 0.05 # Base movement speed
self.speed = 0.055 # Base movement speed
self.item_type = item_type
self.channel = None
self._currentX = x # Initialize the current x position
def update(self, current_time):
"""Update item position"""
def update(self, current_time, player_pos):
"""Update item position
Args:
current_time: Current game time in milliseconds
player_pos: Current player x position
"""
if not self.isActive:
return False
# Update position
self._currentX += self.direction * self.speed
# Update positional audio
if self.channel is None or not self.channel.get_busy():
self.channel = obj_play(self.sounds, "item_bounce", self.xPos, self._currentX)
self.channel = obj_play(self.sounds, "item_bounce", player_pos, self._currentX)
else:
self.channel = obj_update(self.channel, self.xPos, self._currentX)
# Check if item has gone too far (20 tiles)
if abs(self._currentX - self.xRange[0]) > 20:
self.channel = obj_update(self.channel, player_pos, self._currentX)
# Check if item has gone too far (12 tiles)
if abs(self._currentX - player_pos) > 12:
self.isActive = False
if self.channel:
self.channel.stop()
self.channel = None
return False
return True
def apply_effect(self, player):