lint and spacing fixes. Also fixed problem with levels not showing up in compiled version (hopefully).
This commit is contained in:
		| @@ -14,7 +14,7 @@ class Pumpkin: | ||||
|         self.isActive = True | ||||
|         self.damage = playerMaxHealth // 2  # Half of player's max health | ||||
|         self.soundChannel = None | ||||
|         self.soundName = 'pumpkin_low' if isHigh else 'pumpkin_high'  # Inverted mapping | ||||
|         self.soundName = "pumpkin_low" if isHigh else "pumpkin_high"  # Inverted mapping | ||||
|  | ||||
|     def update(self, sounds, playerX): | ||||
|         """Update pumpkin position and sound""" | ||||
| @@ -39,7 +39,7 @@ class Pumpkin: | ||||
|             # Calculate volume and pan for splat sound based on final position | ||||
|             volume, left, right = calculate_volume_and_pan(playerX, self.x) | ||||
|             if volume > 0:  # Only play if within audible range | ||||
|                 obj_play(sounds, 'pumpkin_splat', playerX, self.x, loop=False) | ||||
|                 obj_play(sounds, "pumpkin_splat", playerX, self.x, loop=False) | ||||
|  | ||||
|     def check_collision(self, player): | ||||
|         """Check if pumpkin hits player""" | ||||
| @@ -58,7 +58,9 @@ class Pumpkin: | ||||
| class Catapult(Object): | ||||
|     def __init__(self, x, y, sounds, direction=1, fireInterval=5000, firingRange=20): | ||||
|         super().__init__( | ||||
|             x, y, "catapult", | ||||
|             x, | ||||
|             y, | ||||
|             "catapult", | ||||
|             isStatic=True, | ||||
|             isCollectible=False, | ||||
|         ) | ||||
| @@ -77,18 +79,14 @@ class Catapult(Object): | ||||
|         self.lastFireTime = currentTime | ||||
|  | ||||
|         # Play launch sound using directional audio | ||||
|         play_directional_sound(self.sounds, 'catapult_launch', player.xPos, self.xPos) | ||||
|         play_directional_sound(self.sounds, "catapult_launch", player.xPos, self.xPos) | ||||
|  | ||||
|         # Set up pending pumpkin | ||||
|         isHigh = random.choice([True, False]) | ||||
|         fireDirection = 1 if player.xPos > self.xPos else -1 | ||||
|  | ||||
|         # Store pumpkin data for later creation | ||||
|         self.pendingPumpkin = { | ||||
|             'isHigh': isHigh, | ||||
|             'direction': fireDirection, | ||||
|             'playerMaxHealth': player.get_max_health() | ||||
|         } | ||||
|         self.pendingPumpkin = {"isHigh": isHigh, "direction": fireDirection, "playerMaxHealth": player.get_max_health()} | ||||
|  | ||||
|         # Set when to actually launch the pumpkin | ||||
|         self.pumpkinLaunchTime = currentTime + self.launchDelay | ||||
| @@ -116,9 +114,9 @@ class Catapult(Object): | ||||
|             # Create and fire the pending pumpkin | ||||
|             pumpkin = Pumpkin( | ||||
|                 self.xPos, | ||||
|                 self.pendingPumpkin['isHigh'], | ||||
|                 self.pendingPumpkin['direction'], | ||||
|                 self.pendingPumpkin['playerMaxHealth'] | ||||
|                 self.pendingPumpkin["isHigh"], | ||||
|                 self.pendingPumpkin["direction"], | ||||
|                 self.pendingPumpkin["playerMaxHealth"], | ||||
|             ) | ||||
|             self.activePumpkins.append(pumpkin) | ||||
|             self.pendingPumpkin = None | ||||
| @@ -140,6 +138,4 @@ class Catapult(Object): | ||||
|                 pumpkin.isActive = False | ||||
|                 self.activePumpkins.remove(pumpkin) | ||||
|                 if not player.isInvincible: | ||||
|                     self.sounds['player_takes_damage'].play() | ||||
|  | ||||
|  | ||||
|                     self.sounds["player_takes_damage"].play() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user