diff --git a/assets/bosses.json b/assets/bosses.json index c8bf044..e714b3e 100644 --- a/assets/bosses.json +++ b/assets/bosses.json @@ -1,7 +1,11 @@ { "RAT_KING": { "components": [ - {"_type": "BossFight", "background": "boss_fight_background", "weapon_sound": "Sword_Hit_2"}, + {"_type": "BossFight", + "background": "boss_fight_background", + "stage": "none", + "weapon_sound": "Sword_Hit_2" + }, {"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false}, {"_type": "Animation", "easing": 3, "ease_rate": 0.2, "simple": false, "frames": 2, "speed": 0.02, "scale": 0.2}, {"_type": "Sprite", "name": "rat_king_boss", "width": 720, "height": 720, "scale": 0.8, "stationary": false}, @@ -12,6 +16,7 @@ "components": [ {"_type": "BossFight", "background": "devils_fingers_background", + "stage": "none", "weapon_sound": "Sword_Hit_2" }, {"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false}, diff --git a/assets/config.json b/assets/config.json index 4b45c4c..ab53aec 100644 --- a/assets/config.json +++ b/assets/config.json @@ -48,7 +48,10 @@ "down_the_well": "assets/down_the_well.jpg", "boss_fight_background": "assets/rat_king_boss_fight_background.jpg", "devils_fingers_background": "assets/devils_fingers_background.jpg", - "devils_fingers_sprite": "assets/devils_fingers_sprite.png" + "devils_fingers_sprite": "assets/devils_fingers_sprite.png", + "devils_fingers_stage": "assets/devils_fingers_stage.png", + "tunnel_with_rocks": "assets/tunnel_with_rocks.png", + "tunnel_with_rocks_stage": "assets/tunnel_with_rocks_stage.png" }, "worldgen": { "enemy_probability": 80, diff --git a/assets/devils_fingers_stage.png b/assets/devils_fingers_stage.png new file mode 100644 index 0000000..21263dd Binary files /dev/null and b/assets/devils_fingers_stage.png differ diff --git a/assets/tunnel_with_rocks.png b/assets/tunnel_with_rocks.png new file mode 100644 index 0000000..42a011b Binary files /dev/null and b/assets/tunnel_with_rocks.png differ diff --git a/assets/tunnel_with_rocks_stage.png b/assets/tunnel_with_rocks_stage.png new file mode 100644 index 0000000..eec2f4a Binary files /dev/null and b/assets/tunnel_with_rocks_stage.png differ diff --git a/boss_fight_ui.cpp b/boss_fight_ui.cpp index a9220f3..d6cd0ae 100644 --- a/boss_fight_ui.cpp +++ b/boss_fight_ui.cpp @@ -50,9 +50,16 @@ namespace gui { void BossFightUI::configure_background() { auto& boss = $world->get($boss_id); + $boss_has_stage = boss.stage != "none"; + $boss_background = textures::get(boss.background); $boss_background.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y}); $status.world().set_the({$status.$parser}); + + if($boss_has_stage) { + $boss_stage = textures::get(boss.stage); + $boss_stage.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y}); + } } void BossFightUI::configure_gui() { @@ -114,6 +121,10 @@ namespace gui { window.draw(*$boss_image.sprite); } + if($boss_has_stage) { + window.draw(*$boss_stage.sprite); + } + if($combat.hp == 0) { $overlay.show_label("overlay_1", "YOU WON!"); $overlay.show_label("overlay_4", "CLICK TO CONTINUE..."); diff --git a/boss_fight_ui.hpp b/boss_fight_ui.hpp index ef09526..8d48495 100644 --- a/boss_fight_ui.hpp +++ b/boss_fight_ui.hpp @@ -28,6 +28,8 @@ namespace gui { guecs::UI $overlay; textures::SpriteTexture $boss_image; textures::SpriteTexture $boss_background; + bool $boss_has_stage = false; + textures::SpriteTexture $boss_stage; std::shared_ptr $world = nullptr; DinkyECS::Entity $boss_id; components::GameConfig& $config; diff --git a/components.hpp b/components.hpp index f31f62d..8ca708d 100644 --- a/components.hpp +++ b/components.hpp @@ -69,6 +69,7 @@ namespace components { struct BossFight { std::string background; + std::string stage; std::string weapon_sound; }; @@ -128,7 +129,7 @@ namespace components { template struct NameOf; ENROLL_COMPONENT(Tile, display, foreground, background); - ENROLL_COMPONENT(BossFight, background, weapon_sound); + ENROLL_COMPONENT(BossFight, background, stage, weapon_sound); ENROLL_COMPONENT(Sprite, name, width, height, scale); ENROLL_COMPONENT(Curative, hp); ENROLL_COMPONENT(LightSource, strength, radius);