diff --git a/assets/bosses.json b/assets/bosses.json index 17615e3..5d9a47d 100644 --- a/assets/bosses.json +++ b/assets/bosses.json @@ -1,12 +1,28 @@ { "RAT_KING": { - "background": "boss_fight_background", - "weapon_sound": "Sword_Hit_2", "components": [ + {"_type": "BossFight", "background": "boss_fight_background", "weapon_sound": "Sword_Hit_2"}, {"_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": "Animation", "easing": 3, "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"} ] + }, + "DEVILS_FINGERS": { + "components": [ + {"_type": "BossFight", + "background": "devils_fingers_background", + "weapon_sound": "Sword_Hit_2" + }, + {"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false}, + {"_type": "Animation", "easing": 0, "ease_rate": 0.1, "scale": 0.2, "simple": true, "frames": 2, "speed": 0.02, "scale": 0.2}, + {"_type": "Sprite", + "name": "devils_fingers_sprite", + "width": 720, + "height": 720, + "scale": 1.0 + }, + {"_type": "Sound", "attack": "Spider_1", "death": "Spider_2"} + ] } } diff --git a/assets/config.json b/assets/config.json index a2a7c8d..4b45c4c 100644 --- a/assets/config.json +++ b/assets/config.json @@ -46,7 +46,9 @@ "axe_ranger": "assets/axe_ranger-256.png", "hairy_spider": "assets/hairy_spider-256.png", "down_the_well": "assets/down_the_well.jpg", - "boss_fight_background": "assets/rat_king_boss_fight_background.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" }, "worldgen": { "enemy_probability": 80, diff --git a/assets/devils_fingers_background.jpg b/assets/devils_fingers_background.jpg new file mode 100644 index 0000000..7c87308 Binary files /dev/null and b/assets/devils_fingers_background.jpg differ diff --git a/assets/devils_fingers_sprite.png b/assets/devils_fingers_sprite.png new file mode 100644 index 0000000..3b0526e Binary files /dev/null and b/assets/devils_fingers_sprite.png differ diff --git a/boss_fight_ui.cpp b/boss_fight_ui.cpp index f362869..d1c72d2 100644 --- a/boss_fight_ui.cpp +++ b/boss_fight_ui.cpp @@ -47,10 +47,8 @@ namespace gui { } void BossFightUI::configure_background() { - // FIX ME - // auto& config = $world->get_the(); - std::string boss_bg = "boss_fight_background"; - $boss_background = textures::get(boss_bg); + auto& boss = $world->get($boss_id); + $boss_background = textures::get(boss.background); $boss_background.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y}); $status.world().set_the({$status.$parser}); } diff --git a/components.cpp b/components.cpp index e5b3cbf..12ba26a 100644 --- a/components.cpp +++ b/components.cpp @@ -12,6 +12,7 @@ namespace components { } void configure(ComponentMap& component_map) { + components::enroll(component_map); components::enroll(component_map); components::enroll(component_map); components::enroll(component_map); @@ -36,6 +37,8 @@ namespace components { float Animation::twitching() { switch(easing) { + case ease::NONE: + return 0.0; case ease::SINE: return ease::sine(float(frames) / subframe * ease_rate); case ease::OUT_CIRC: diff --git a/components.hpp b/components.hpp index b24b711..ad769d0 100644 --- a/components.hpp +++ b/components.hpp @@ -67,6 +67,11 @@ namespace components { int hp = 10; }; + struct BossFight { + std::string background; + std::string weapon_sound; + }; + struct Combat { int hp; int max_hp; @@ -122,6 +127,7 @@ namespace components { template struct NameOf; ENROLL_COMPONENT(Tile, display, foreground, background); + ENROLL_COMPONENT(BossFight, background, weapon_sound); ENROLL_COMPONENT(Sprite, name, width, height, scale); ENROLL_COMPONENT(Curative, hp); ENROLL_COMPONENT(LightSource, strength, radius); diff --git a/easings.hpp b/easings.hpp index 6770b5d..5c6aa26 100644 --- a/easings.hpp +++ b/easings.hpp @@ -4,7 +4,7 @@ namespace ease { enum Style { - SINE, OUT_CIRC, OUT_BOUNCE, IN_OUT_BACK, NONE + NONE, SINE, OUT_CIRC, OUT_BOUNCE, IN_OUT_BACK }; inline double sine(double x) { diff --git a/levelmanager.cpp b/levelmanager.cpp index 5d2112d..5b72929 100644 --- a/levelmanager.cpp +++ b/levelmanager.cpp @@ -39,7 +39,7 @@ shared_ptr LevelManager::create_bossfight(shared_ptrget_the(); - auto& boss_data = config.bosses["RAT_KING"]; + auto& boss_data = config.bosses["DEVILS_FINGERS"]; auto boss_id = world->entity(); components::configure_entity($components, *world, boss_id, boss_data["components"]);