Code cleanup, added more functionality. Floating coffins that spawn items, graves can spawn zombies, etc.

This commit is contained in:
Storm Dragon
2025-01-30 22:22:59 -05:00
parent 53009373c2
commit 6c000d78d8
10 changed files with 402 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
from libstormgames import *
class Object:
def __init__(self, x, yPos, soundName, isStatic=True, isCollectible=False, isHazard=False):
def __init__(self, x, yPos, soundName, isStatic=True, isCollectible=False, isHazard=False, zombie_spawn_chance=0):
# x can be either a single position or a range [start, end]
self.xRange = [x, x] if isinstance(x, (int, float)) else x
self.yPos = yPos
@@ -9,6 +9,8 @@ class Object:
self.isStatic = isStatic
self.isCollectible = isCollectible
self.isHazard = isHazard
self.zombie_spawn_chance = zombie_spawn_chance
self.has_spawned = False # Track if this object has spawned a zombie
self.channel = None # For tracking the sound channel
self.isActive = True
# For collectibles in a range, track which positions have been collected