Stats tracking updated. Work on skull storms. Enemy death sound added for goblins. Various updates and fixes.
This commit is contained in:
		
							
								
								
									
										23
									
								
								src/level.py
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								src/level.py
									
									
									
									
									
								
							| @@ -72,7 +72,8 @@ class Level: | ||||
|                 coffin = CoffinObject( | ||||
|                     xPos[0], | ||||
|                     obj["y"], | ||||
|                     self.sounds | ||||
|                     self.sounds, | ||||
|                     self  # Pass level reference | ||||
|                 ) | ||||
|                 self.objects.append(coffin) | ||||
|             # Check if this is an enemy | ||||
| @@ -82,6 +83,7 @@ class Level: | ||||
|                     obj["y"], | ||||
|                     obj["enemy_type"], | ||||
|                     self.sounds, | ||||
|                     self,  # Pass level reference | ||||
|                     health=obj.get("health", 5), | ||||
|                     damage=obj.get("damage", 1), | ||||
|                     attack_range=obj.get("attack_range", 1), | ||||
| @@ -99,6 +101,10 @@ class Level: | ||||
|                     zombie_spawn_chance=obj.get("zombie_spawn_chance", 0) | ||||
|                 ) | ||||
|                 self.objects.append(gameObject) | ||||
|         enemyCount = len(self.enemies) | ||||
|         coffinCount = sum(1 for obj in self.objects if hasattr(obj, 'is_broken')) | ||||
|         player.stats.update_stat('Enemies remaining', enemyCount) | ||||
|         player.stats.update_stat('Coffins remaining', coffinCount) | ||||
|  | ||||
|     def update_audio(self): | ||||
|         """Update all audio and entity state.""" | ||||
| @@ -126,6 +132,7 @@ class Level: | ||||
|                             obj.yPos, | ||||
|                             "zombie", | ||||
|                             self.sounds, | ||||
|                             self,  # Pass the level reference | ||||
|                             health=3, | ||||
|                             damage=10, | ||||
|                             attack_range=1 | ||||
| @@ -235,13 +242,19 @@ class Level: | ||||
|                         self.sounds[f'get_{obj.soundName}'].play() | ||||
|                         obj.collect_at_position(currentPos) | ||||
|                         self.player.collectedItems.append(obj.soundName) | ||||
|                         self.player.stats.update_stat('Items collected', 1) | ||||
|                         if obj.soundName == "coin": | ||||
|                             self.player._coins += 1 | ||||
|                             self.player.stats.update_stat('Bone dust', 1) | ||||
|                 elif obj.isHazard and not self.player.isJumping: | ||||
|                     self.sounds[obj.soundName].play() | ||||
|                     speak("You fell in an open grave!") | ||||
|                     self.player.set_health(0) | ||||
|                     return False | ||||
|                     if not self.player.isInvincible: | ||||
|                         self.sounds[obj.soundName].play() | ||||
|                         speak("You fell in an open grave!") | ||||
|                         self.player.set_health(0) | ||||
|                         return False | ||||
|                     else: | ||||
|                         # When invincible, treat it like a successful jump over the grave | ||||
|                         pass | ||||
|  | ||||
|         # Handle boundaries | ||||
|         if self.player.xPos < self.leftBoundary: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user