New weapon, witch's broom, added. New enemy type, witch, added.

This commit is contained in:
Storm Dragon
2025-02-07 15:13:27 -05:00
parent 419f605466
commit e0e097a397
13 changed files with 119 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
from libstormgames import *
from src.object import Object
from src.powerup import PowerUp
import pygame
class Enemy(Object):
@@ -171,5 +172,25 @@ class Enemy(Object):
if deathSound in self.sounds:
self.channel = obj_play(self.sounds, deathSound, self.level.player.xPos, self.xPos, loop=False)
# Handle witch-specific drops
if self.enemyType == "witch":
# Determine which item to drop
hasBroom = any(weapon.name == "witch_broom" for weapon in self.level.player.weapons)
itemType = "cauldron" if hasBroom else "witch_broom"
# Create drop 1-2 tiles away in random direction
direction = random.choice([-1, 1])
dropDistance = random.randint(1, 2)
dropX = self.xPos + (direction * dropDistance)
droppedItem = PowerUp(
dropX,
self.yPos,
itemType,
self.sounds,
direction
)
self.level.bouncing_items.append(droppedItem)
# Update stats
self.level.player.stats.update_stat('Enemies killed', 1)