More sounds added. Warning for edge of grave added, but it's not quite right yet.

This commit is contained in:
Storm Dragon
2025-01-31 03:23:54 -05:00
parent dfbccb97ad
commit fcc2dbf44a
9 changed files with 131 additions and 12 deletions
+95 -5
View File
@@ -8,7 +8,14 @@
},
"objects": [
{
"x_range": [5, 7],
"x": 5,
"y": 3,
"sound": "coin",
"collectible": true,
"static": true
},
{
"x_range": [15, 17],
"y": 3,
"sound": "coin",
"collectible": true,
@@ -19,21 +26,104 @@
"y": 0,
"enemy_type": "goblin",
"health": 5,
"damage": 1,
"damage": 2,
"attack_range": 1,
"movement_range": 5
},
{
"x": 50,
"x": 30,
"y": 3,
"sound": "coin",
"collectible": true,
"static": true
},
{
"x": 40,
"y": 0,
"hazard": true,
"sound": "grave",
"static": true,
"zombie_spawn_chance": 100
"zombie_spawn_chance": 10
},
{
"x_range": [45, 47],
"y": 3,
"sound": "coin",
"collectible": true,
"static": true
},
{
"x": 55,
"y": 3,
"sound": "coin",
"collectible": true,
"static": true
},
{
"x": 60,
"y": 0,
"enemy_type": "goblin",
"health": 5,
"damage": 2,
"attack_range": 1,
"movement_range": 5
},
{
"x": 70,
"y": 0,
"hazard": true,
"sound": "grave",
"static": true,
"zombie_spawn_chance": 15
},
{
"x_range": [80, 82],
"y": 3,
"sound": "coin",
"collectible": true,
"static": true
},
{
"x": 90,
"y": 0,
"hazard": true,
"sound": "grave",
"static": true,
"zombie_spawn_chance": 20
},
{
"x": 100,
"y": 3,
"sound": "coin",
"collectible": true,
"static": true
},
{
"x": 110,
"y": 0,
"hazard": true,
"sound": "grave",
"static": true,
"zombie_spawn_chance": 25
},
{
"x_range": [120, 123],
"y": 3,
"sound": "coin",
"collectible": true,
"static": true
},
{
"x": 130,
"y": 0,
"hazard": true,
"sound": "grave",
"static": true,
"zombie_spawn_chance": 30
}
],
"boundaries": {
"left": 0,
"right": 500
"right": 150
}
}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+14 -4
View File
@@ -139,23 +139,33 @@ class Level:
obj.xPos <= attackRange[1] and
self.player.isJumping): # Must be jumping to hit floating coffins
if obj.hit(self.player.xPos):
self.bouncing_items.append(obj.dropped_item)
speak(f"{obj.dropped_item.item_type} falls out!")
if obj.hit(self.player.xPos):
self.bouncing_items.append(obj.dropped_item)
speak(f"{obj.dropped_item.item_type} falls out!")
def handle_collisions(self):
for obj in self.objects:
if not obj.isActive:
continue
# Handle grave edge warnings
if obj.isHazard:
distance = abs(self.player.xPos - obj.xPos)
# Check if within 1 tile and moving
if distance <= 1 and not self.player.isJumping:
# Play edge warning sound (don't need to track the channel)
self.sounds['edge'].play()
if obj.is_in_range(self.player.xPos):
if obj.isCollectible and self.player.isJumping:
currentPos = round(self.player.xPos)
if currentPos not in obj.collectedPositions:
self.sounds[f'get_{obj.soundName}'].play()
speak(f"Collected {obj.soundName}")
obj.collect_at_position(currentPos)
self.player.collectedItems.append(obj.soundName)
if obj.soundName == "coin":
self.player._coins += 1
elif obj.isHazard and not self.player.isJumping:
self.sounds[obj.soundName].play()
speak("You fell in an open grave!")
+5 -1
View File
@@ -19,7 +19,7 @@ class Player:
# Inventory system
self.inventory = []
self.collectedItems = []
self.coins = 0
self._coins = 0
# Combat related attributes
self.weapons = []
@@ -103,6 +103,10 @@ class Player:
if self._lives > 0:
self._health = 10 # Reset health if we still have lives
def get_coins(self):
"""Get remaining coins"""
return self._coins
def get_lives(self):
"""Get remaining lives"""
return self._lives