Final boss in place, updated levels.
This commit is contained in:
@@ -257,20 +257,17 @@
|
||||
"static": true
|
||||
},
|
||||
{
|
||||
"x_range": [400, 415],
|
||||
"x_range": [400, 420],
|
||||
"y": 0,
|
||||
"enemy_type": "ghost",
|
||||
"health": 16,
|
||||
"damage": 2,
|
||||
"enemy_type": "revenant",
|
||||
"health": 40,
|
||||
"damage": 1,
|
||||
"attack_range": 1,
|
||||
"vulnerability_duration": 2000,
|
||||
"invulnerability_duration": 5000,
|
||||
"speed_multiplier": 0.8,
|
||||
"attack_cooldown": 1200,
|
||||
"zombie_spawn_cooldown": 2500,
|
||||
"attack_pattern": {
|
||||
"type": "patrol"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"boundaries": {
|
||||
"left": 0,
|
||||
|
@@ -238,11 +238,26 @@
|
||||
"sound": "coin",
|
||||
"collectible": true,
|
||||
"static": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"x_range": [400, 415],
|
||||
"y": 0,
|
||||
"enemy_type": "ghost",
|
||||
"health": 20,
|
||||
"damage": 2,
|
||||
"attack_range": 1,
|
||||
"vulnerability_duration": 1000,
|
||||
"invulnerability_duration": 5000,
|
||||
"speed_multiplier": 0.8,
|
||||
"attack_cooldown": 1200,
|
||||
"attack_pattern": {
|
||||
"type": "patrol"
|
||||
}
|
||||
}
|
||||
],
|
||||
"boundaries": {
|
||||
"left": 0,
|
||||
"right": 325
|
||||
"right": 420
|
||||
},
|
||||
"ambience": "Wayward Ghouls.ogg",
|
||||
"footstep_sound": "footstep_stone"
|
||||
|
BIN
sounds/revenant.ogg
(Stored with Git LFS)
Normal file
BIN
sounds/revenant.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
sounds/revenant_dies.ogg
(Stored with Git LFS)
Normal file
BIN
sounds/revenant_dies.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
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