Animations are refactored to let me spawn in an 'attack animation' but I think the data model is wrong. Rather than spawning in an animation every time I can probably just make one, reposition it, then tell it to play. I'll have to try it.

This commit is contained in:
Zed A. Shaw 2025-09-12 11:56:11 -04:00
parent 8384b11993
commit ad3e580495
15 changed files with 109 additions and 56 deletions

View file

@ -412,6 +412,7 @@ namespace gui {
draw_gui();
}
System::clear_attack();
$window.display();
}

View file

@ -45,7 +45,7 @@ namespace gui {
$ritual_ui = textures::get_sprite("ritual_crafting_area");
$ritual_ui.sprite->setPosition($gui.get_position());
$ritual_ui.sprite->setTextureRect($ritual_closed_rect);
$ritual_anim = animation::load("ritual_blanket");
$ritual_anim = animation::load("ritual_crafting_area");
auto open_close_toggle = $gui.entity("ritual_ui");
$gui.set<Clickable>(open_close_toggle, {
@ -84,7 +84,6 @@ namespace gui {
}
}
void UI::CLOSED(Event ev) {
if(ev == Event::TOGGLE) {
$ritual_anim.play();
@ -95,7 +94,7 @@ namespace gui {
void UI::OPENING(Event ev) {
if(ev == Event::TICK) {
if(!animation::apply($ritual_anim, $ritual_ui)) {
if(!animation::apply($ritual_anim, *$ritual_ui.sprite)) {
state(State::OPENED);
}
}