Mostly working torch sprites have taught me what I need for the animation system.

This commit is contained in:
Zed A. Shaw 2025-10-18 00:13:44 -04:00
parent a578c49a77
commit 59ba73baa0
5 changed files with 35 additions and 2 deletions

View file

@ -27,6 +27,12 @@ namespace boss {
dbc::check(animation::has(sprite.name), "add boss animation to animations.json");
$boss_anim = animation::load(sprite.name);
$torch_left = textures::get_sprite("torch_crappy");
$torch_left_anim = animation::load("torch_crappy");
$torch_right.texture = $torch_left.texture;
$torch_right.sprite = std::make_shared<sf::Sprite>(*$torch_right.texture);
$torch_right_anim = animation::load("torch_crappy");
}
void UI::init() {
@ -37,7 +43,7 @@ namespace boss {
$arena.layout(
"[status|boss1 |boss2 |boss3 |boss4 |_]"
"[_ |boss5 |boss6 |boss7 |boss8 |_]"
"[torch1|boss5 |boss6 |boss7 |boss8 |torch2]"
"[floor1|boss9 |boss10|boss11|boss12|_]"
"[floor2|boss13|boss14|boss15|boss16|_]"
"[floor3|player1|player2|player3|player4|_]"
@ -51,6 +57,9 @@ namespace boss {
position_sprite($floor_sprite, $scene.floor_pos, 1.0, false);
}
position_sprite($torch_left, "torch1", 1.0, false);
position_sprite($torch_right, "torch2", 1.0, false);
$arena.init();
$actions.position(0,0, SCREEN_WIDTH-BOSS_VIEW_WIDTH, SCREEN_HEIGHT);
@ -94,6 +103,9 @@ namespace boss {
window.draw(*$boss_sprite.sprite);
window.draw(*$player_sprite.sprite);
window.draw(*$torch_left.sprite);
window.draw(*$torch_right.sprite);
// $arena.debug_layout(window);
}

View file

@ -25,6 +25,11 @@ namespace boss {
components::Animation $boss_anim;
sf::Vector2f $boss_pos;
SpriteTexture $torch_left;
SpriteTexture $torch_right;
components::Animation $torch_left_anim;
components::Animation $torch_right_anim;
UI(shared_ptr<World> world, Entity boss_id);
void init();