new item, shin bone , added.

This commit is contained in:
Storm Dragon
2025-02-10 20:49:50 -05:00
parent a991829cf9
commit 2351579bb5
15 changed files with 70 additions and 24 deletions

View File

@@ -157,7 +157,7 @@
"sound": "grave", "sound": "grave",
"static": true, "static": true,
"zombie_spawn_chance": 0, "zombie_spawn_chance": 0,
"item": "guts" "item": "shin_bone"
} }
], ],
"boundaries": { "boundaries": {

View File

@@ -61,8 +61,7 @@
"x": 55, "x": 55,
"y": 3, "y": 3,
"sound": "coffin", "sound": "coffin",
"type": "coffin", "type": "coffin"
"item": "guts"
}, },
{ {
"x_range": [65, 70], "x_range": [65, 70],
@@ -140,7 +139,7 @@
"x_range": [165, 175], "x_range": [165, 175],
"y": 0, "y": 0,
"enemy_type": "witch", "enemy_type": "witch",
"health": 2, "health": 3,
"damage": 2, "damage": 2,
"attack_range": 1.5, "attack_range": 1.5,
"attack_pattern": { "attack_pattern": {

View File

@@ -144,7 +144,7 @@
"x_range": [101, 111], "x_range": [101, 111],
"y": 0, "y": 0,
"enemy_type": "witch", "enemy_type": "witch",
"health": 6, "health": 3,
"damage": 2, "damage": 2,
"attack_range": 1, "attack_range": 1,
"attack_pattern": { "attack_pattern": {
@@ -196,7 +196,7 @@
"x_range": [146, 166], "x_range": [146, 166],
"y": 0, "y": 0,
"enemy_type": "ghoul", "enemy_type": "ghoul",
"health": 10, "health": 6,
"damage": 3, "damage": 3,
"attack_range": 2, "attack_range": 2,
"attack_pattern": { "attack_pattern": {

View File

@@ -24,7 +24,7 @@
"x_range": [20, 30], "x_range": [20, 30],
"y": 0, "y": 0,
"enemy_type": "goblin", "enemy_type": "goblin",
"health": 3, "health": 4,
"damage": 2, "damage": 2,
"attack_range": 1, "attack_range": 1,
"attack_pattern": { "attack_pattern": {
@@ -61,14 +61,13 @@
"x": 55, "x": 55,
"y": 3, "y": 3,
"sound": "coffin", "sound": "coffin",
"type": "coffin", "type": "coffin"
"item": "guts"
}, },
{ {
"x_range": [60, 70], "x_range": [60, 70],
"y": 0, "y": 0,
"enemy_type": "witch", "enemy_type": "witch",
"health": 4, "health": 6,
"damage": 2, "damage": 2,
"attack_range": 1, "attack_range": 1,
"attack_pattern": { "attack_pattern": {
@@ -81,6 +80,7 @@
"type": "grave", "type": "grave",
"sound": "grave", "sound": "grave",
"static": true, "static": true,
"item": "guts",
"zombie_spawn_chance": 10 "zombie_spawn_chance": 10
}, },
{ {
@@ -169,7 +169,7 @@
"x_range": [175, 185], "x_range": [175, 185],
"y": 0, "y": 0,
"enemy_type": "ghoul", "enemy_type": "ghoul",
"health": 8, "health": 6,
"damage": 2, "damage": 2,
"attack_range": 1.5, "attack_range": 1.5,
"attack_pattern": { "attack_pattern": {

View File

@@ -25,8 +25,8 @@
{ {
"x_range": [20, 35], "x_range": [20, 35],
"y": 0, "y": 0,
"enemy_type": "witch", "enemy_type": "goblin",
"health": 5, "health": 4,
"damage": 2, "damage": 2,
"attack_range": 1.5, "attack_range": 1.5,
"attack_pattern": { "attack_pattern": {
@@ -69,7 +69,7 @@
"x_range": [65, 80], "x_range": [65, 80],
"y": 0, "y": 0,
"enemy_type": "ghoul", "enemy_type": "ghoul",
"health": 8, "health": 6,
"damage": 2, "damage": 2,
"attack_range": 1.5, "attack_range": 1.5,
"attack_pattern": { "attack_pattern": {
@@ -120,7 +120,7 @@
"x_range": [120, 135], "x_range": [120, 135],
"y": 0, "y": 0,
"enemy_type": "witch", "enemy_type": "witch",
"health": 5, "health": 6,
"damage": 2, "damage": 2,
"attack_range": 1.5, "attack_range": 1.5,
"attack_pattern": { "attack_pattern": {
@@ -153,7 +153,7 @@
"x_range": [160, 180], "x_range": [160, 180],
"y": 0, "y": 0,
"enemy_type": "ghoul", "enemy_type": "ghoul",
"health": 10, "health": 6,
"damage": 3, "damage": 3,
"attack_range": 2, "attack_range": 2,
"attack_pattern": { "attack_pattern": {

View File

@@ -22,8 +22,8 @@
{ {
"x_range": [20, 35], "x_range": [20, 35],
"y": 0, "y": 0,
"enemy_type": "witch", "enemy_type": "goblin",
"health": 6, "health": 4,
"damage": 2, "damage": 2,
"attack_range": 1.5, "attack_range": 1.5,
"attack_pattern": { "attack_pattern": {
@@ -149,7 +149,7 @@
"x_range": [160, 180], "x_range": [160, 180],
"y": 0, "y": 0,
"enemy_type": "ghoul", "enemy_type": "ghoul",
"health": 10, "health": 8,
"damage": 3, "damage": 3,
"attack_range": 2, "attack_range": 2,
"attack_pattern": { "attack_pattern": {

View File

@@ -65,6 +65,7 @@
"type": "grave", "type": "grave",
"sound": "grave", "sound": "grave",
"static": true, "static": true,
"item": "shin_bone",
"zombie_spawn_chance": 20 "zombie_spawn_chance": 20
}, },
{ {
@@ -178,8 +179,7 @@
"type": "grave", "type": "grave",
"sound": "grave", "sound": "grave",
"static": true, "static": true,
"item": "hand_of_glory", "zombie_spawn_chance": 20
"zombie_spawn_chance": 0
}, },
{ {
"type": "spider_web", "type": "spider_web",

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

View File

@@ -181,7 +181,9 @@ class Enemy(Object):
if self.enemyType == "witch": if self.enemyType == "witch":
# Determine which item to drop # Determine which item to drop
hasBroom = any(weapon.name == "witch_broom" for weapon in self.level.player.weapons) hasBroom = any(weapon.name == "witch_broom" for weapon in self.level.player.weapons)
itemType = "cauldron" if hasBroom else "witch_broom" hasNunchucks = any(weapon.name == "nunchucks" for weapon in self.level.player.weapons)
# Drop witch_broom only if player has neither broom nor nunchucks
itemType = "witch_broom" if not (hasBroom or hasNunchucks) else "cauldron"
# Create drop 1-2 tiles away in random direction # Create drop 1-2 tiles away in random direction
direction = random.choice([-1, 1]) direction = random.choice([-1, 1])

View File

@@ -43,6 +43,7 @@ class Player:
self.collectedItems = [] self.collectedItems = []
self._coins = 0 self._coins = 0
self._jack_o_lantern_count = 0 self._jack_o_lantern_count = 0
self.shinBoneCount = 0
# Combat related attributes # Combat related attributes
self.weapons = [] self.weapons = []

View File

@@ -49,10 +49,16 @@ class PowerUp(Object):
player.restore_health() player.restore_health()
elif self.item_type == 'guts': elif self.item_type == 'guts':
player.add_guts() player.add_guts()
player.collectedItems.append('guts')
self.check_for_nunchucks(player)
elif self.item_type == 'jack_o_lantern': elif self.item_type == 'jack_o_lantern':
player.add_jack_o_lantern() player.add_jack_o_lantern()
elif self.item_type == 'extra_life': elif self.item_type == 'extra_life':
player.extra_life() player.extra_life()
elif self.item_type == 'shin_bone': # Add shin bone handling
player.shinBoneCount += 1
player._coins += 5
self.check_for_nunchucks(player)
elif self.item_type == 'witch_broom': elif self.item_type == 'witch_broom':
broomWeapon = Weapon.create_witch_broom() broomWeapon = Weapon.create_witch_broom()
player.add_weapon(broomWeapon) player.add_weapon(broomWeapon)
@@ -81,3 +87,16 @@ class PowerUp(Object):
# Item tracking # Item tracking
player.stats.update_stat('Items collected', 1) player.stats.update_stat('Items collected', 1)
def check_for_nunchucks(self, player):
"""Check if player has materials for nunchucks and create if conditions are met"""
print("Checking for nunchucks.")
print(f"Player has {player.shinBoneCount} shin bones and {player.collectedItems}.")
if (player.shinBoneCount >= 2 and
'guts' in player.collectedItems and
not any(weapon.name == "nunchucks" for weapon in player.weapons)):
nunchucksWeapon = Weapon.create_nunchucks()
player.add_weapon(nunchucksWeapon)
player.equip_weapon(nunchucksWeapon)
play_sound(self.sounds['get_nunchucks'])
player.stats.update_stat('Items collected', 1)

View File

@@ -10,6 +10,19 @@ class Weapon:
self.lastAttackTime = 0 self.lastAttackTime = 0
self.hitEnemies = set() self.hitEnemies = set()
@classmethod
def create_nunchucks(cls):
"""Create the nunchucks weapon"""
return cls(
name="nunchucks",
damage=6,
range=4,
attackSound="player_nunchuck_attack",
hitSound="player_nunchuck_hit",
cooldown=250,
attackDuration=100
)
@classmethod @classmethod
def create_witch_broom(cls): def create_witch_broom(cls):
"""Create the witch's broom weapon""" """Create the witch's broom weapon"""