Basic ability to create a 'stage' for a boss fight, which is a thing in front the boss animates behind.
This commit is contained in:
parent
8b414c13e6
commit
243b4c2663
8 changed files with 25 additions and 3 deletions
|
@ -1,7 +1,11 @@
|
||||||
{
|
{
|
||||||
"RAT_KING": {
|
"RAT_KING": {
|
||||||
"components": [
|
"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": "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": "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},
|
{"_type": "Sprite", "name": "rat_king_boss", "width": 720, "height": 720, "scale": 0.8, "stationary": false},
|
||||||
|
@ -12,6 +16,7 @@
|
||||||
"components": [
|
"components": [
|
||||||
{"_type": "BossFight",
|
{"_type": "BossFight",
|
||||||
"background": "devils_fingers_background",
|
"background": "devils_fingers_background",
|
||||||
|
"stage": "none",
|
||||||
"weapon_sound": "Sword_Hit_2"
|
"weapon_sound": "Sword_Hit_2"
|
||||||
},
|
},
|
||||||
{"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false},
|
{"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 20, "dead": false},
|
||||||
|
|
|
@ -48,7 +48,10 @@
|
||||||
"down_the_well": "assets/down_the_well.jpg",
|
"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_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": {
|
"worldgen": {
|
||||||
"enemy_probability": 80,
|
"enemy_probability": 80,
|
||||||
|
|
BIN
assets/devils_fingers_stage.png
Normal file
BIN
assets/devils_fingers_stage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 79 KiB |
BIN
assets/tunnel_with_rocks.png
Normal file
BIN
assets/tunnel_with_rocks.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 818 KiB |
BIN
assets/tunnel_with_rocks_stage.png
Normal file
BIN
assets/tunnel_with_rocks_stage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 413 KiB |
|
@ -50,9 +50,16 @@ namespace gui {
|
||||||
|
|
||||||
void BossFightUI::configure_background() {
|
void BossFightUI::configure_background() {
|
||||||
auto& boss = $world->get<components::BossFight>($boss_id);
|
auto& boss = $world->get<components::BossFight>($boss_id);
|
||||||
|
$boss_has_stage = boss.stage != "none";
|
||||||
|
|
||||||
$boss_background = textures::get(boss.background);
|
$boss_background = textures::get(boss.background);
|
||||||
$boss_background.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y});
|
$boss_background.sprite->setPosition({BOSS_VIEW_X, BOSS_VIEW_Y});
|
||||||
$status.world().set_the<Background>({$status.$parser});
|
$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() {
|
void BossFightUI::configure_gui() {
|
||||||
|
@ -114,6 +121,10 @@ namespace gui {
|
||||||
window.draw(*$boss_image.sprite);
|
window.draw(*$boss_image.sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($boss_has_stage) {
|
||||||
|
window.draw(*$boss_stage.sprite);
|
||||||
|
}
|
||||||
|
|
||||||
if($combat.hp == 0) {
|
if($combat.hp == 0) {
|
||||||
$overlay.show_label("overlay_1", "YOU WON!");
|
$overlay.show_label("overlay_1", "YOU WON!");
|
||||||
$overlay.show_label("overlay_4", "CLICK TO CONTINUE...");
|
$overlay.show_label("overlay_4", "CLICK TO CONTINUE...");
|
||||||
|
|
|
@ -28,6 +28,8 @@ namespace gui {
|
||||||
guecs::UI $overlay;
|
guecs::UI $overlay;
|
||||||
textures::SpriteTexture $boss_image;
|
textures::SpriteTexture $boss_image;
|
||||||
textures::SpriteTexture $boss_background;
|
textures::SpriteTexture $boss_background;
|
||||||
|
bool $boss_has_stage = false;
|
||||||
|
textures::SpriteTexture $boss_stage;
|
||||||
std::shared_ptr<DinkyECS::World> $world = nullptr;
|
std::shared_ptr<DinkyECS::World> $world = nullptr;
|
||||||
DinkyECS::Entity $boss_id;
|
DinkyECS::Entity $boss_id;
|
||||||
components::GameConfig& $config;
|
components::GameConfig& $config;
|
||||||
|
|
|
@ -69,6 +69,7 @@ namespace components {
|
||||||
|
|
||||||
struct BossFight {
|
struct BossFight {
|
||||||
std::string background;
|
std::string background;
|
||||||
|
std::string stage;
|
||||||
std::string weapon_sound;
|
std::string weapon_sound;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,7 +129,7 @@ namespace components {
|
||||||
template <typename T> struct NameOf;
|
template <typename T> struct NameOf;
|
||||||
|
|
||||||
ENROLL_COMPONENT(Tile, display, foreground, background);
|
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(Sprite, name, width, height, scale);
|
||||||
ENROLL_COMPONENT(Curative, hp);
|
ENROLL_COMPONENT(Curative, hp);
|
||||||
ENROLL_COMPONENT(LightSource, strength, radius);
|
ENROLL_COMPONENT(LightSource, strength, radius);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue