Final boss in place, updated levels.
This commit is contained in:
		
							
								
								
									
										37
									
								
								src/enemy.py
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								src/enemy.py
									
									
									
									
									
								
							| @@ -57,6 +57,15 @@ class Enemy(Object): | ||||
|                 'type': 'hunter', | ||||
|                 'turn_threshold': 2 | ||||
|             }) | ||||
|         elif enemyType == "revenant": | ||||
|             self.movementSpeed *= 0.7  # Slower than normal | ||||
|             self.damage = 1 | ||||
|             self.health = kwargs.get('health', 40) | ||||
|             self.attackCooldown = 1500  # Slower direct attacks | ||||
|             self.zombieSpawnCooldown = kwargs.get('zombie_spawn_cooldown', 2000)  # 2 seconds between spawns | ||||
|             self.lastZombieSpawn = 0 | ||||
|             self.zombieSpawnDistance = 5 | ||||
|             self.attackPattern = kwargs.get('attack_pattern', {'type': 'patrol'}) | ||||
|         elif enemyType == "spider": | ||||
|             speedMultiplier = kwargs.get('speed_multiplier', 2.0) | ||||
|             self.movementSpeed *= speedMultiplier  # Spiders are faster | ||||
| @@ -136,6 +145,34 @@ class Enemy(Object): | ||||
|             # Other enemies and non-activated hunters use patrol pattern | ||||
|             self.patrol_movement() | ||||
|              | ||||
|         if self.enemyType == "revenant" and self.hunting:  # Only spawn when player enters territory | ||||
|                 # Check if it's time to spawn a zombie | ||||
|                 if currentTime - self.lastZombieSpawn >= self.zombieSpawnCooldown: | ||||
|                     # Spawn zombies relative to player position, not revenant | ||||
|                     spawnDirection = random.choice([-1, 1]) | ||||
|                     spawnX = player.xPos + (spawnDirection * self.zombieSpawnDistance) | ||||
|          | ||||
|                     # Ensure spawn point is within level boundaries | ||||
|                     spawnX = max(self.level.leftBoundary, min(spawnX, self.level.rightBoundary)) | ||||
|          | ||||
|                     # Create new zombie | ||||
|                     zombie = Enemy( | ||||
|                         [spawnX, spawnX],  # Single point range for spawn | ||||
|                         self.yPos, | ||||
|                         "zombie", | ||||
|                         self.sounds, | ||||
|                         self.level | ||||
|                     ) | ||||
|          | ||||
|                     # Add to level's enemies | ||||
|                     self.level.enemies.append(zombie) | ||||
|                     self.lastZombieSpawn = currentTime | ||||
|          | ||||
|                     # Play spawn sound and speak message | ||||
|                     if 'revenant_spawn_zombie' in self.sounds: | ||||
|                         self.sounds['revenant_spawn_zombie'].play() | ||||
|                     speak("Zombie spawned") | ||||
|  | ||||
|         # Check for attack opportunity | ||||
|         if self.can_attack(currentTime, player): | ||||
|             self.attack(currentTime, player) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user