Some minor cleanup.
This commit is contained in:
@@ -20,7 +20,7 @@ class CoffinObject(Object):
|
||||
self.isBroken = False
|
||||
self.dropped_item = None
|
||||
self.specified_item = item
|
||||
|
||||
|
||||
def hit(self, player_pos):
|
||||
"""Handle being hit by the player's weapon"""
|
||||
if not self.isBroken:
|
||||
@@ -28,15 +28,15 @@ class CoffinObject(Object):
|
||||
play_sound(self.sounds['coffin_shatter'])
|
||||
self.level.levelScore += 500
|
||||
self.level.player.stats.update_stat('Coffins broken', 1)
|
||||
|
||||
|
||||
# Stop the ongoing coffin sound
|
||||
if self.channel:
|
||||
obj_stop(self.channel)
|
||||
self.channel = None
|
||||
|
||||
|
||||
# Mark coffin as inactive since it's broken
|
||||
self.isActive = False
|
||||
|
||||
|
||||
# Determine item to drop
|
||||
if self.specified_item == "random":
|
||||
item_type = ItemProperties.get_random_item()
|
||||
@@ -47,12 +47,12 @@ class CoffinObject(Object):
|
||||
else:
|
||||
# Fall back to random if invalid item specified
|
||||
item_type = ItemProperties.get_random_item()
|
||||
|
||||
|
||||
# Create item 1-2 tiles away in random direction
|
||||
direction = random.choice([-1, 1])
|
||||
drop_distance = random.randint(1, 2)
|
||||
drop_x = self.xPos + (direction * drop_distance)
|
||||
|
||||
|
||||
self.dropped_item = PowerUp(
|
||||
drop_x,
|
||||
self.yPos,
|
||||
|
Reference in New Issue
Block a user