from libstormgames import * from src.object import Object from src.powerup import PowerUp class GraveObject(Object): def __init__(self, x, y, sounds, item=None, zombieSpawnChance=0): super().__init__( x, y, "grave", isStatic=True, isCollectible=False, isHazard=True, zombieSpawnChance=zombieSpawnChance ) self.graveItem = item self.isCollected = False # Renamed to match style of isHazard, isStatic etc self.sounds = sounds def collect_grave_item(self, player): """Handle collection of items from graves via ducking. Returns: bool: True if item was collected, False if player should die """ # If grave has no item or item was already collected, player dies if not self.graveItem or self.isCollected: return False # Collect the item if player is ducking if player.isDucking: self.isCollected = True # Mark as collected when collection succeeds return True return False