diff --git a/assets/bosses.json b/assets/bosses.json index bc419d3..17615e3 100644 --- a/assets/bosses.json +++ b/assets/bosses.json @@ -3,11 +3,9 @@ "background": "boss_fight_background", "weapon_sound": "Sword_Hit_2", "components": [ - {"_type": "Combat", "hp": 50, "max_hp": 50, "damage": 50, "dead": false}, - {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, - {"_type": "EnemyConfig", "hearing_distance": 3}, - {"_type": "Animation", "easing": 2, "ease_rate": 0.2, "scale": 0.2, "simple": false, "frames": 2, "speed": 0.02}, - {"_type": "Sprite", "name": "rat_king_boss", "width": 720, "height": 720}, + {"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false}, + {"_type": "Animation", "easing": 2, "ease_rate": 0.2, "scale": 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}, {"_type": "Sound", "attack": "Marmot_Scream_1", "death": "Creature_Death_1"} ] } diff --git a/assets/devices.json b/assets/devices.json index f5033ee..44482fc 100644 --- a/assets/devices.json +++ b/assets/devices.json @@ -14,7 +14,7 @@ {"_type": "Device", "config": {"test": true}, "events": ["Events::GUI::STAIRS_DOWN"]}, - {"_type": "Sprite", "name": "well_down", "width": 256, "height": 256} + {"_type": "Sprite", "name": "well_down", "width": 256, "height": 256, "scale": 1.0} ] }, "STAIRS_UP": { @@ -31,7 +31,7 @@ {"_type": "Device", "config": {"test": true}, "events": ["Events::GUI::STAIRS_UP"]}, - {"_type": "Sprite", "name": "rope_vines_up", "width": 256, "height": 256} + {"_type": "Sprite", "name": "rope_vines_up", "width": 256, "height": 256, "scale": 1.0} ] }, "TRIPWIRE_TRAP": { @@ -47,7 +47,7 @@ {"_type": "Device", "config": {"test": true}, "events": ["Events::GUI::TRAP"]}, - {"_type": "Sprite", "name": "tripwire_trap", "width": 256, "height": 256} + {"_type": "Sprite", "name": "tripwire_trap", "width": 256, "height": 256, "scale": 1.0} ] } } diff --git a/assets/enemies.json b/assets/enemies.json index f639fd9..5ab6150 100644 --- a/assets/enemies.json +++ b/assets/enemies.json @@ -21,7 +21,7 @@ {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, {"_type": "EnemyConfig", "hearing_distance": 5}, {"_type": "Animation", "easing": 1, "ease_rate": 0.2, "scale": 0.1, "simple": true, "frames": 10, "speed": 0.3}, - {"_type": "Sprite", "name": "armored_knight", "width": 256, "height": 256, "width": 256, "height": 256}, + {"_type": "Sprite", "name": "armored_knight", "width": 256, "height": 256, "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "Sword_Hit_2", "death": "Humanoid_Death_1"} ] }, @@ -34,25 +34,11 @@ {"_type": "Combat", "hp": 40, "max_hp": 40, "damage": 10, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": true}, {"_type": "EnemyConfig", "hearing_distance": 5}, - {"_type": "Sprite", "name": "axe_ranger", "width": 256, "height": 256}, + {"_type": "Sprite", "name": "axe_ranger", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Animation", "easing": 3, "ease_rate": 0.5, "scale": 0.1, "simple": false, "frames": 2, "speed": 0.6}, {"_type": "Sound", "attack": "Sword_Hit_2", "death": "Ranger_1"} ] }, - "EVIL_EYE": { - "components": [ - {"_type": "Tile", "display": "\u0758", - "foreground": [205, 164, 246], - "background": [30, 20, 75] - }, - {"_type": "Combat", "hp": 50, "max_hp": 50, "damage": 50, "dead": false}, - {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, - {"_type": "EnemyConfig", "hearing_distance": 5}, - {"_type": "Sprite", "name": "evil_eye", "width": 256, "height": 256}, - {"_type": "Animation", "easing": 3, "ease_rate": 0.1, "scale": 0.1, "simple": false, "frames": 2, "speed": 0.1}, - {"_type": "Sound", "attack": "Evil_Eye_Sound_2", "death": "Evil_Eye_Sound_1"} - ] - }, "RAT_GIANT": { "components": [ {"_type": "Tile", "display": "\u08ac", @@ -63,7 +49,7 @@ {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, {"_type": "EnemyConfig", "hearing_distance": 10}, {"_type": "Animation", "easing": 3, "ease_rate": 0.5, "scale": 0.1, "simple": true, "frames": 10, "speed": 1.0}, - {"_type": "Sprite", "name": "rat_with_sword", "width": 256, "height": 256}, + {"_type": "Sprite", "name": "rat_with_sword", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "Small_Rat", "death": "Creature_Death_1"} ] }, @@ -77,7 +63,7 @@ {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, {"_type": "EnemyConfig", "hearing_distance": 10}, {"_type": "Animation", "easing": 2, "ease_rate": 0.5, "scale": 0.1, "simple": true, "frames": 10, "speed": 1.0}, - {"_type": "Sprite", "name": "hairy_spider", "width": 256, "height": 256}, + {"_type": "Sprite", "name": "hairy_spider", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "Spider_1", "death": "Spider_2"} ] } diff --git a/assets/items.json b/assets/items.json index f41c140..5bb7d4d 100644 --- a/assets/items.json +++ b/assets/items.json @@ -10,7 +10,7 @@ "foreground": [24, 120, 189], "background": [230,120, 120] }, - {"_type": "Sprite", "name": "torch_horizontal_floor", "width": 256, "height": 256}, + {"_type": "Sprite", "name": "torch_horizontal_floor", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "pickup", "death": "blank"} ] }, @@ -25,7 +25,7 @@ "foreground": [24, 120, 189], "background": [24, 120, 189] }, - {"_type": "Sprite", "name": "cinqueda", "width": 256, "height": 256}, + {"_type": "Sprite", "name": "cinqueda", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "pickup", "death": "blank"} ] }, @@ -39,7 +39,7 @@ "background": [150, 100, 189] }, {"_type": "Loot", "amount": 10}, - {"_type": "Sprite", "name": "barrel_small", "width": 256, "height": 256}, + {"_type": "Sprite", "name": "barrel_small", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "pickup", "death": "blank"} ], "inventory_count": 1 @@ -55,7 +55,7 @@ "background": [24, 205, 210] }, {"_type": "LightSource", "strength": 50, "radius": 2.8}, - {"_type": "Sprite", "name": "torch_pillar", "width": 256, "height": 256}, + {"_type": "Sprite", "name": "torch_pillar", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "pickup", "death": "blank"} ] }, @@ -70,7 +70,7 @@ "background": [255, 205, 189] }, {"_type": "Curative", "hp": 20}, - {"_type": "Sprite", "name": "healing_potion_small", "width": 256, "height": 256}, + {"_type": "Sprite", "name": "healing_potion_small", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "pickup", "death": "blank"} ] }, @@ -85,7 +85,7 @@ "background": [24, 205, 189] }, {"_type": "Loot", "amount": 10}, - {"_type": "Sprite", "name": "grave_stone", "width": 256, "height": 256}, + {"_type": "Sprite", "name": "grave_stone", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "pickup", "death": "blank"} ] } diff --git a/boss_fight_ui.cpp b/boss_fight_ui.cpp index 26e3fe9..da982e8 100644 --- a/boss_fight_ui.cpp +++ b/boss_fight_ui.cpp @@ -3,9 +3,10 @@ #include "sound.hpp" namespace gui { - BossFightUI::BossFightUI(GameLevel level, std::string boss_name) - : $level(level), - $config($level.world->get_the()), + using namespace guecs; + + BossFightUI::BossFightUI(DinkyECS::World& world, std::string boss_name) + : $config(world.get_the()), $boss_name(boss_name) { $status.position(0, 0, BOSS_VIEW_X, SCREEN_HEIGHT); @@ -24,6 +25,7 @@ namespace gui { "[overlay_13|overlay_14|overlay_16]"); $sounds = components::get($config.bosses[boss_name]); + $combat = components::get($config.bosses[boss_name]); $weapon_hit_sound = $config.bosses[$boss_name]["weapon_sound"]; } @@ -36,7 +38,7 @@ namespace gui { $boss_image = textures::get($sprite_config.name); sf::IntRect frame_rect{{0,0},{$sprite_config.width,$sprite_config.height}}; $boss_image.sprite->setTextureRect(frame_rect); - $boss_image.sprite->setScale($scale); + $boss_image.sprite->setScale({$sprite_config.scale, $sprite_config.scale}); auto bounds = $boss_image.sprite->getLocalBounds(); auto bg_bounds = $boss_background.sprite->getLocalBounds(); @@ -60,7 +62,7 @@ namespace gui { [this, name](auto, auto){ fmt::println("STATUS: {}", name); } }); if(name == "main_status") { - $status.set(button, {fmt::format("HP: {}", $boss_hp)}); + $status.set(button, {fmt::format("HP: {}", $combat.hp)}); } else { $status.set