Basic ability to create a 'stage' for a boss fight, which is a thing in front the boss animates behind.

master
Zed A. Shaw 5 days ago
parent 8b414c13e6
commit 243b4c2663
  1. 7
      assets/bosses.json
  2. 5
      assets/config.json
  3. BIN
      assets/devils_fingers_stage.png
  4. BIN
      assets/tunnel_with_rocks.png
  5. BIN
      assets/tunnel_with_rocks_stage.png
  6. 11
      boss_fight_ui.cpp
  7. 2
      boss_fight_ui.hpp
  8. 3
      components.hpp

@ -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},

@ -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,

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 KiB

@ -50,9 +50,16 @@ namespace gui {
void BossFightUI::configure_background() {
auto& boss = $world->get<components::BossFight>($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<Background>({$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...");

@ -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<DinkyECS::World> $world = nullptr;
DinkyECS::Entity $boss_id;
components::GameConfig& $config;

@ -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 <typename T> 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);

Loading…
Cancel
Save