From ffb0f8cb4da06b864a2e6efb635351290a29b24b Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 9 Feb 2025 17:05:49 -0500 Subject: [PATCH] Added a strategic pygame.event.pump() in level.py. Levels 4-7 added, will probably need refining. --- levels/Wicked Quest/4.json | 281 ++++++++++++++----------------------- levels/Wicked Quest/5.json | 191 +++++++++++++++++++++++++ levels/Wicked Quest/6.json | 194 +++++++++++++++++++++++++ levels/Wicked Quest/7.json | 280 ++++++++++++++++++++++++++++++++++++ src/level.py | 3 + 5 files changed, 772 insertions(+), 177 deletions(-) create mode 100644 levels/Wicked Quest/5.json create mode 100644 levels/Wicked Quest/6.json create mode 100644 levels/Wicked Quest/7.json diff --git a/levels/Wicked Quest/4.json b/levels/Wicked Quest/4.json index d6a49b2..30a2f17 100644 --- a/levels/Wicked Quest/4.json +++ b/levels/Wicked Quest/4.json @@ -1,7 +1,7 @@ { "level_id": 4, - "name": "Spider's Domain", - "description": "The spiders have claimed this part of the graveyard. Be careful to not disturb them. You know how spiders think, if you can't eat it, kill it!", + "name": "The Abandoned Church", + "description": "The graves led you to a decrepit church. The holy ground offers no sanctuary - if anything, the undead seem stronger here.", "player_start": { "x": 0, "y": 0 @@ -14,11 +14,6 @@ "collectible": true, "static": true }, - { - "type": "spider_web", - "x": 10, - "y": 0 - }, { "x": 15, "y": 3, @@ -26,17 +21,10 @@ "type": "coffin" }, { - "x_range": [20, 23], - "y": 3, - "sound": "coin", - "collectible": true, - "static": true - }, - { - "x_range": [25, 35], + "x_range": [20, 30], "y": 0, "enemy_type": "goblin", - "health": 4, + "health": 3, "damage": 2, "attack_range": 1, "attack_pattern": { @@ -44,7 +32,15 @@ } }, { - "x_range": [30, 45], + "x": 35, + "y": 0, + "type": "grave", + "sound": "grave", + "static": true, + "zombie_spawn_chance": 10 + }, + { + "x_range": [40, 55], "y": 12, "type": "skull_storm", "damage": 3, @@ -55,36 +51,24 @@ } }, { - "type": "spider_web", - "x": 40, - "y": 0 - }, - { - "x": 45, - "y": 0, - "type": "grave", - "sound": "grave", - "static": true, - "zombie_spawn_chance": 0 - }, - { - "x_range": [50, 54], + "x_range": [45, 48], "y": 3, "sound": "coin", "collectible": true, "static": true }, { - "x": 60, + "x": 55, "y": 3, "sound": "coffin", - "type": "coffin" + "type": "coffin", + "item": "guts" }, { - "x_range": [65, 85], + "x_range": [60, 70], "y": 0, "enemy_type": "witch", - "health": 8, + "health": 4, "damage": 2, "attack_range": 1, "attack_pattern": { @@ -92,189 +76,132 @@ } }, { - "type": "spider_web", "x": 75, - "y": 0 - }, - { - "x_range": [80, 95], - "y": 15, - "type": "skull_storm", - "damage": 4, - "maximum_skulls": 3, - "frequency": { - "min": 1, - "max": 3 - } - }, - { - "x_range": [90, 93], - "y": 3, - "sound": "coin", - "collectible": true, - "static": true - }, - { - "x": 100, - "y": 0, - "type": "catapult", - "fire_interval": 4000, - "range": 20 - }, - { - "x": 110, "y": 0, "type": "grave", "sound": "grave", "static": true, - "zombie_spawn_chance": 50 + "zombie_spawn_chance": 10 }, { - "x_range": [115, 118], + "x_range": [80, 83], "y": 3, "sound": "coin", "collectible": true, "static": true }, { - "type": "spider_web", - "x": 120, - "y": 0 + "x": 90, + "y": 0, + "type": "catapult", + "fire_interval": 4500, + "range": 20 }, { - "x_range": [125, 145], + "x_range": [95, 115], + "y": 15, + "type": "skull_storm", + "damage": 3, + "maximum_skulls": 3, + "frequency": { + "min": 2, + "max": 4 + } + }, + { + "x_range": [100, 103], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 110, + "y": 3, + "sound": "coffin", + "type": "coffin" + }, + { + "x_range": [120, 130], "y": 0, "enemy_type": "ghoul", - "health": 12, - "damage": 3, - "attack_range": 2, + "health": 6, + "damage": 2, + "attack_range": 1.5, "attack_pattern": { - "type": "hunter", - "turn_threshold": 4 + "type": "patrol" } }, { "x": 135, - "y": 3, - "sound": "coffin", - "type": "coffin" - }, - { - "x_range": [140, 160], - "y": 15, - "type": "skull_storm", - "damage": 4, - "maximum_skulls": 3, - "frequency": { - "min": 1, - "max": 3 - } - }, - { - "x_range": [150, 153], - "y": 3, - "sound": "coin", - "collectible": true, - "static": true - }, - { - "x": 165, "y": 0, "type": "grave", "sound": "grave", "static": true, - "item": "guts", - "zombie_spawn_chance": 0 + "zombie_spawn_chance": 10 }, { - "type": "spider_web", - "x": 175, - "y": 0 - }, - { - "x_range": [180, 200], - "y": 0, - "enemy_type": "witch", - "health": 8, - "damage": 2, - "attack_range": 1, - "attack_pattern": { - "type": "patrol" - } - }, - { - "x_range": [185, 188], + "x_range": [140, 143], "y": 3, "sound": "coin", "collectible": true, "static": true }, + { + "x_range": [150, 170], + "y": 12, + "type": "skull_storm", + "damage": 3, + "maximum_skulls": 2, + "frequency": { + "min": 2, + "max": 4 + } + }, + { + "x": 165, + "y": 3, + "sound": "coffin", + "type": "coffin", + "item": "extra_life" + }, + { + "x_range": [175, 185], + "y": 0, + "enemy_type": "ghoul", + "health": 8, + "damage": 2, + "attack_range": 1.5, + "attack_pattern": { + "type": "hunter", + "turn_threshold": 6 + } + }, + { + "x_range": [180, 183], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 190, + "y": 0, + "type": "grave", + "sound": "grave", + "static": true, + "zombie_spawn_chance": 10 + }, { "x": 195, "y": 3, - "item": "hand_of_glory", - "sound": "coffin", - "type": "coffin" - }, - { - "x_range": [205, 225], - "y": 12, - "type": "skull_storm", - "damage": 4, - "maximum_skulls": 3, - "frequency": { - "min": 1, - "max": 3 - } - }, - { - "x_range": [210, 213], - "y": 3, - "sound": "coin", - "collectible": true, - "static": true - }, - { - "type": "spider_web", - "x": 220, - "y": 0 - }, - { - "x": 225, - "y": 0, - "type": "catapult", - "fire_interval": 4000, - "range": 20 - }, - { - "x_range": [230, 245], - "y": 0, - "enemy_type": "ghoul", - "health": 12, - "damage": 3, - "attack_range": 2, - "attack_pattern": { - "type": "hunter", - "turn_threshold": 4 - } - }, - { - "x_range": [235, 238], - "y": 3, - "sound": "coin", - "collectible": true, - "static": true - }, - { - "x": 245, - "y": 3, "sound": "coffin", "type": "coffin" } ], "boundaries": { "left": 0, - "right": 250 + "right": 200 }, - "footstep_sound": "footstep_tall_grass" + "footstep_sound": "footstep_stone" } diff --git a/levels/Wicked Quest/5.json b/levels/Wicked Quest/5.json new file mode 100644 index 0000000..6fa4850 --- /dev/null +++ b/levels/Wicked Quest/5.json @@ -0,0 +1,191 @@ +{ + "level_id": 5, + "name": "The Cursed Catacombs", + "description": "Deep beneath the church lies an ancient network of tunnels. The air is thick with dark magic, and the walls seem to pulse with malevolent energy.", + "player_start": { + "x": 0, + "y": 0 + }, + "objects": [ + { + "x_range": [5, 8], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 15, + "y": 0, + "type": "grave", + "sound": "grave", + "static": true, + "zombie_spawn_chance": 15 + }, + { + "x_range": [20, 35], + "y": 0, + "enemy_type": "witch", + "health": 5, + "damage": 2, + "attack_range": 1.5, + "attack_pattern": { + "type": "hunter", + "turn_threshold": 5 + } + }, + { + "x": 30, + "y": 3, + "sound": "coffin", + "type": "coffin" + }, + { + "x_range": [40, 60], + "y": 12, + "type": "skull_storm", + "damage": 4, + "maximum_skulls": 2, + "frequency": { + "min": 1, + "max": 4 + } + }, + { + "x_range": [45, 48], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 55, + "y": 0, + "type": "catapult", + "fire_interval": 4000, + "range": 25 + }, + { + "x_range": [65, 80], + "y": 0, + "enemy_type": "ghoul", + "health": 8, + "damage": 2, + "attack_range": 1.5, + "attack_pattern": { + "type": "patrol" + } + }, + { + "x": 75, + "y": 3, + "sound": "coffin", + "type": "coffin", + "item": "hand_of_glory" + }, + { + "x_range": [85, 88], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 95, + "y": 0, + "type": "grave", + "sound": "grave", + "static": true, + "zombie_spawn_chance": 15 + }, + { + "x_range": [100, 125], + "y": 15, + "type": "skull_storm", + "damage": 4, + "maximum_skulls": 3, + "frequency": { + "min": 1, + "max": 3 + } + }, + { + "x_range": [110, 113], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x_range": [120, 135], + "y": 0, + "enemy_type": "witch", + "health": 5, + "damage": 2, + "attack_range": 1.5, + "attack_pattern": { + "type": "hunter", + "turn_threshold": 5 + } + }, + { + "x": 140, + "y": 3, + "sound": "coffin", + "type": "coffin" + }, + { + "x": 145, + "y": 0, + "type": "grave", + "sound": "grave", + "static": true, + "zombie_spawn_chance": 15 + }, + { + "x_range": [150, 153], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x_range": [160, 180], + "y": 0, + "enemy_type": "ghoul", + "health": 10, + "damage": 3, + "attack_range": 2, + "attack_pattern": { + "type": "hunter", + "turn_threshold": 4 + } + }, + { + "x": 175, + "y": 0, + "type": "catapult", + "fire_interval": 4000, + "range": 25 + }, + { + "x_range": [185, 188], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 195, + "y": 3, + "sound": "coffin", + "type": "coffin", + "item": "extra_life" + } + ], + "boundaries": { + "left": 0, + "right": 200 + }, + "footstep_sound": "footstep_stone" +} diff --git a/levels/Wicked Quest/6.json b/levels/Wicked Quest/6.json new file mode 100644 index 0000000..7f96a7f --- /dev/null +++ b/levels/Wicked Quest/6.json @@ -0,0 +1,194 @@ +{ + "level_id": 6, + "name": "The Webbed Crypts", + "description": "The catacombs open into ancient crypts, their passages choked with massive cobwebs. Something skitters in the darkness above.", + "player_start": { + "x": 0, + "y": 0 + }, + "objects": [ + { + "x_range": [5, 8], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "type": "spider_web", + "x": 15, + "y": 0 + }, + { + "x_range": [20, 35], + "y": 0, + "enemy_type": "witch", + "health": 6, + "damage": 2, + "attack_range": 1.5, + "attack_pattern": { + "type": "hunter", + "turn_threshold": 4 + } + }, + { + "x": 30, + "y": 3, + "sound": "coffin", + "type": "coffin" + }, + { + "x_range": [40, 65], + "y": 12, + "type": "skull_storm", + "damage": 4, + "maximum_skulls": 3, + "frequency": { + "min": 1, + "max": 3 + } + }, + { + "x": 45, + "y": 0, + "type": "grave", + "sound": "grave", + "static": true, + "zombie_spawn_chance": 20 + }, + { + "x_range": [50, 53], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 60, + "y": 0, + "type": "catapult", + "fire_interval": 4000, + "range": 30 + }, + { + "x_range": [70, 85], + "y": 0, + "enemy_type": "ghoul", + "health": 10, + "damage": 3, + "attack_range": 2, + "attack_pattern": { + "type": "hunter", + "turn_threshold": 4 + } + }, + { + "x": 80, + "y": 3, + "sound": "coffin", + "type": "coffin", + "item": "hand_of_glory" + }, + { + "type": "spider_web", + "x": 90, + "y": 0 + }, + { + "x_range": [95, 98], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 105, + "y": 0, + "type": "grave", + "sound": "grave", + "static": true, + "zombie_spawn_chance": 20 + }, + { + "x_range": [110, 135], + "y": 15, + "type": "skull_storm", + "damage": 4, + "maximum_skulls": 3, + "frequency": { + "min": 1, + "max": 3 + } + }, + { + "x_range": [120, 123], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x_range": [130, 145], + "y": 0, + "enemy_type": "witch", + "health": 6, + "damage": 2, + "attack_range": 1.5, + "attack_pattern": { + "type": "hunter", + "turn_threshold": 4 + } + }, + { + "x": 150, + "y": 3, + "sound": "coffin", + "type": "coffin" + }, + { + "x_range": [160, 180], + "y": 0, + "enemy_type": "ghoul", + "health": 12, + "damage": 3, + "attack_range": 2, + "attack_pattern": { + "type": "hunter", + "turn_threshold": 4 + } + }, + { + "x_range": [165, 168], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 175, + "y": 0, + "type": "catapult", + "fire_interval": 4000, + "range": 30 + }, + { + "x_range": [185, 188], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 195, + "y": 3, + "sound": "coffin", + "type": "coffin", + "item": "extra_life" + } + ], + "boundaries": { + "left": 0, + "right": 200 + }, + "footstep_sound": "footstep_tall_grass" +} diff --git a/levels/Wicked Quest/7.json b/levels/Wicked Quest/7.json new file mode 100644 index 0000000..d6a49b2 --- /dev/null +++ b/levels/Wicked Quest/7.json @@ -0,0 +1,280 @@ +{ + "level_id": 4, + "name": "Spider's Domain", + "description": "The spiders have claimed this part of the graveyard. Be careful to not disturb them. You know how spiders think, if you can't eat it, kill it!", + "player_start": { + "x": 0, + "y": 0 + }, + "objects": [ + { + "x_range": [5, 8], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "type": "spider_web", + "x": 10, + "y": 0 + }, + { + "x": 15, + "y": 3, + "sound": "coffin", + "type": "coffin" + }, + { + "x_range": [20, 23], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x_range": [25, 35], + "y": 0, + "enemy_type": "goblin", + "health": 4, + "damage": 2, + "attack_range": 1, + "attack_pattern": { + "type": "patrol" + } + }, + { + "x_range": [30, 45], + "y": 12, + "type": "skull_storm", + "damage": 3, + "maximum_skulls": 2, + "frequency": { + "min": 2, + "max": 4 + } + }, + { + "type": "spider_web", + "x": 40, + "y": 0 + }, + { + "x": 45, + "y": 0, + "type": "grave", + "sound": "grave", + "static": true, + "zombie_spawn_chance": 0 + }, + { + "x_range": [50, 54], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 60, + "y": 3, + "sound": "coffin", + "type": "coffin" + }, + { + "x_range": [65, 85], + "y": 0, + "enemy_type": "witch", + "health": 8, + "damage": 2, + "attack_range": 1, + "attack_pattern": { + "type": "patrol" + } + }, + { + "type": "spider_web", + "x": 75, + "y": 0 + }, + { + "x_range": [80, 95], + "y": 15, + "type": "skull_storm", + "damage": 4, + "maximum_skulls": 3, + "frequency": { + "min": 1, + "max": 3 + } + }, + { + "x_range": [90, 93], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 100, + "y": 0, + "type": "catapult", + "fire_interval": 4000, + "range": 20 + }, + { + "x": 110, + "y": 0, + "type": "grave", + "sound": "grave", + "static": true, + "zombie_spawn_chance": 50 + }, + { + "x_range": [115, 118], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "type": "spider_web", + "x": 120, + "y": 0 + }, + { + "x_range": [125, 145], + "y": 0, + "enemy_type": "ghoul", + "health": 12, + "damage": 3, + "attack_range": 2, + "attack_pattern": { + "type": "hunter", + "turn_threshold": 4 + } + }, + { + "x": 135, + "y": 3, + "sound": "coffin", + "type": "coffin" + }, + { + "x_range": [140, 160], + "y": 15, + "type": "skull_storm", + "damage": 4, + "maximum_skulls": 3, + "frequency": { + "min": 1, + "max": 3 + } + }, + { + "x_range": [150, 153], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 165, + "y": 0, + "type": "grave", + "sound": "grave", + "static": true, + "item": "guts", + "zombie_spawn_chance": 0 + }, + { + "type": "spider_web", + "x": 175, + "y": 0 + }, + { + "x_range": [180, 200], + "y": 0, + "enemy_type": "witch", + "health": 8, + "damage": 2, + "attack_range": 1, + "attack_pattern": { + "type": "patrol" + } + }, + { + "x_range": [185, 188], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 195, + "y": 3, + "item": "hand_of_glory", + "sound": "coffin", + "type": "coffin" + }, + { + "x_range": [205, 225], + "y": 12, + "type": "skull_storm", + "damage": 4, + "maximum_skulls": 3, + "frequency": { + "min": 1, + "max": 3 + } + }, + { + "x_range": [210, 213], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "type": "spider_web", + "x": 220, + "y": 0 + }, + { + "x": 225, + "y": 0, + "type": "catapult", + "fire_interval": 4000, + "range": 20 + }, + { + "x_range": [230, 245], + "y": 0, + "enemy_type": "ghoul", + "health": 12, + "damage": 3, + "attack_range": 2, + "attack_pattern": { + "type": "hunter", + "turn_threshold": 4 + } + }, + { + "x_range": [235, 238], + "y": 3, + "sound": "coin", + "collectible": true, + "static": true + }, + { + "x": 245, + "y": 3, + "sound": "coffin", + "type": "coffin" + } + ], + "boundaries": { + "left": 0, + "right": 250 + }, + "footstep_sound": "footstep_tall_grass" +} diff --git a/src/level.py b/src/level.py index 8ef82bd..7c00fa5 100644 --- a/src/level.py +++ b/src/level.py @@ -268,6 +268,9 @@ class Level: def handle_collisions(self): """Handle all collision checks and return True if level is complete.""" + # Add a pump here so it gets called reasonably often. + pygame.event.pump() + # First check if player is dead if self.player.get_health() <= 0: return False