BossFightUI now loads out of LevelManager and is treated like a normal level. This also adds a prototype for a different kind of 'stationary' boss to prototype its motions.
This commit is contained in:
parent
6e8aa48332
commit
eb8fb82837
9 changed files with 35 additions and 10 deletions
|
@ -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"}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
BIN
assets/devils_fingers_background.jpg
Normal file
BIN
assets/devils_fingers_background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 120 KiB |
BIN
assets/devils_fingers_sprite.png
Normal file
BIN
assets/devils_fingers_sprite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 325 KiB |
|
@ -47,10 +47,8 @@ namespace gui {
|
|||
}
|
||||
|
||||
void BossFightUI::configure_background() {
|
||||
// FIX ME
|
||||
// auto& config = $world->get_the<components::GameConfig>();
|
||||
std::string boss_bg = "boss_fight_background";
|
||||
$boss_background = textures::get(boss_bg);
|
||||
auto& boss = $world->get<components::BossFight>($boss_id);
|
||||
$boss_background = textures::get(boss.background);
|
||||
$boss_background.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y});
|
||||
$status.world().set_the<Background>({$status.$parser});
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace components {
|
|||
}
|
||||
|
||||
void configure(ComponentMap& component_map) {
|
||||
components::enroll<BossFight>(component_map);
|
||||
components::enroll<Combat>(component_map);
|
||||
components::enroll<Loot>(component_map);
|
||||
components::enroll<Position>(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:
|
||||
|
|
|
@ -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 <typename T> 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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -39,7 +39,7 @@ shared_ptr<gui::BossFightUI> LevelManager::create_bossfight(shared_ptr<DinkyECS:
|
|||
dbc::check(prev_world != nullptr, "Starter world for boss fights can't be null.");
|
||||
auto world = clone_load_world(prev_world);
|
||||
auto& config = prev_world->get_the<GameConfig>();
|
||||
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"]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue