Level updates. Fixed a bug with hunting enemies. Boosted sound for headless horseman.

This commit is contained in:
Storm Dragon
2025-02-11 19:02:51 -05:00
parent 5ca8188c2b
commit 7f68af1958
5 changed files with 33 additions and 36 deletions

View File

@@ -26,7 +26,7 @@
"y": 0, "y": 0,
"type": "catapult", "type": "catapult",
"fire_interval": 3000, "fire_interval": 3000,
"range": 40 "range": 30
}, },
{ {
"x_range": [55, 60], "x_range": [55, 60],
@@ -56,7 +56,7 @@
"y": 0, "y": 0,
"type": "catapult", "type": "catapult",
"fire_interval": 3000, "fire_interval": 3000,
"range": 40 "range": 30
}, },
{ {
"x_range": [105, 110], "x_range": [105, 110],
@@ -86,7 +86,7 @@
"y": 0, "y": 0,
"type": "catapult", "type": "catapult",
"fire_interval": 3000, "fire_interval": 3000,
"range": 40 "range": 30
}, },
{ {
"x_range": [145, 165], "x_range": [145, 165],
@@ -117,7 +117,7 @@
"y": 0, "y": 0,
"type": "catapult", "type": "catapult",
"fire_interval": 3000, "fire_interval": 3000,
"range": 40 "range": 30
}, },
{ {
"x_range": [185, 195], "x_range": [185, 195],
@@ -148,7 +148,7 @@
"y": 0, "y": 0,
"type": "catapult", "type": "catapult",
"fire_interval": 3000, "fire_interval": 3000,
"range": 40 "range": 30
}, },
{ {
"x_range": [235, 240], "x_range": [235, 240],
@@ -169,7 +169,7 @@
"y": 0, "y": 0,
"type": "catapult", "type": "catapult",
"fire_interval": 3000, "fire_interval": 3000,
"range": 40 "range": 30
}, },
{ {
"x_range": [265, 285], "x_range": [265, 285],
@@ -194,7 +194,7 @@
"y": 0, "y": 0,
"type": "catapult", "type": "catapult",
"fire_interval": 3000, "fire_interval": 3000,
"range": 40 "range": 30
}, },
{ {
"x_range": [305, 315], "x_range": [305, 315],
@@ -220,7 +220,7 @@
"y": 0, "y": 0,
"type": "catapult", "type": "catapult",
"fire_interval": 3000, "fire_interval": 3000,
"range": 40 "range": 30
}, },
{ {
"x_range": [355, 375], "x_range": [355, 375],

View File

@@ -307,34 +307,25 @@
"x_range": [405, 495], "x_range": [405, 495],
"y": 0, "y": 0,
"enemy_type": "witch", "enemy_type": "witch",
"health": 500, "health": 50,
"damage": 3, "damage": 3,
"attack_range": 2, "attack_range": 2,
"attack_pattern": { "attack_pattern": {
"type": "hunter", "type": "patrol"
"turn_threshold": 3
} }
}, },
{ {
"x_range": [405, 495], "x_range": [405, 495],
"y": 0, "y": 0,
"enemy_type": "boogie_man", "enemy_type": "headless_horseman",
"health": 500, "health": 100,
"damage": 3, "damage": 3,
"attack_range": 2, "attack_range": 3,
"attack_pattern": { "attack_pattern": {
"type": "hunter", "type": "hunter",
"turn_threshold": 3 "turn_threshold": 15
} }
}, },
{
"x": 450,
"y": 0,
"type": "grave",
"sound": "grave",
"static": true,
"zombie_spawn_chance": 100
},
{ {
"x_range": [455, 460], "x_range": [455, 460],
"y": 3, "y": 3,
@@ -359,14 +350,6 @@
"sound": "coin", "sound": "coin",
"collectible": true, "collectible": true,
"static": true "static": true
},
{
"x": 490,
"y": 0,
"type": "grave",
"sound": "grave",
"static": true,
"zombie_spawn_chance": 100
} }
], ],
"boundaries": { "boundaries": {

BIN
sounds/headless_horseman.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
sounds/headless_horseman_dies.ogg (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -5,6 +5,8 @@ import pygame
class Enemy(Object): class Enemy(Object):
def __init__(self, xRange, y, enemyType, sounds, level, **kwargs): def __init__(self, xRange, y, enemyType, sounds, level, **kwargs):
# Track when critters should start hunting
self.hunting = False
# Initialize base object properties # Initialize base object properties
super().__init__( super().__init__(
xRange, xRange,
@@ -74,9 +76,15 @@ class Enemy(Object):
if not self.isActive or self.health <= 0: if not self.isActive or self.health <= 0:
return return
# Check if player has entered territory
if not self.hunting:
if self.patrolStart <= player.xPos <= self.patrolEnd:
self.hunting = True
# Handle movement based on enemy type and pattern # Handle movement based on enemy type and pattern
if self.enemyType == "zombie" or self.attackPattern['type'] == 'hunter': if (self.enemyType == "zombie" or
# Direct chase behavior for zombies and hunters (self.attackPattern['type'] == 'hunter' and self.hunting)):
# Direct chase behavior for zombies and activated hunters
if player.xPos > self.xPos: if player.xPos > self.xPos:
self.movingRight = True self.movingRight = True
self.xPos += self.movementSpeed self.xPos += self.movementSpeed
@@ -92,7 +100,7 @@ class Enemy(Object):
self.xPos = self.level.rightBoundary self.xPos = self.level.rightBoundary
self.movingRight = False self.movingRight = False
else: else:
# Other enemies use patrol pattern # Other enemies and non-activated hunters use patrol pattern
self.patrol_movement() self.patrol_movement()
# Check for attack opportunity # Check for attack opportunity