Making the bossfight function by creating the FSM for it.
This commit is contained in:
parent
06a174040f
commit
231adb6335
3 changed files with 23 additions and 3 deletions
13
boss/ui.cpp
13
boss/ui.cpp
|
|
@ -53,6 +53,7 @@ namespace boss {
|
||||||
auto stats = $actions.entity("stats");
|
auto stats = $actions.entity("stats");
|
||||||
$actions.set<Rectangle>(stats, {});
|
$actions.set<Rectangle>(stats, {});
|
||||||
$actions.set<Text>(stats, {L"stats"});
|
$actions.set<Text>(stats, {L"stats"});
|
||||||
|
$actions.set<Effect>(stats, {});
|
||||||
|
|
||||||
$actions.init();
|
$actions.init();
|
||||||
|
|
||||||
|
|
@ -70,20 +71,28 @@ namespace boss {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI::render(sf::RenderWindow& window) {
|
void UI::render(sf::RenderWindow& window) {
|
||||||
$arena.render(window);
|
|
||||||
$actions.render(window);
|
$actions.render(window);
|
||||||
$combat_ui.render(window);
|
$combat_ui.render(window);
|
||||||
|
$arena.render(window);
|
||||||
|
|
||||||
window.draw(*$floor_sprite.sprite);
|
window.draw(*$floor_sprite.sprite);
|
||||||
window.draw(*$boss_sprite.sprite);
|
window.draw(*$boss_sprite.sprite);
|
||||||
window.draw(*$player_sprite.sprite);
|
window.draw(*$player_sprite.sprite);
|
||||||
|
|
||||||
// $arena.debug_layout(window);
|
// $arena.debug_layout(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UI::mouse(float x, float y, Modifiers mods) {
|
bool UI::mouse(float x, float y, Modifiers mods) {
|
||||||
return $actions.mouse(x, y, mods);
|
return $arena.mouse(x, y, mods)
|
||||||
|
|| $combat_ui.mouse(x, y, mods)
|
||||||
|
|| $actions.mouse(x, y, mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UI::boss_dead() {
|
bool UI::boss_dead() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UI::run_systems() {
|
||||||
|
// does nothing yet
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,5 +33,6 @@ namespace boss {
|
||||||
bool mouse(float x, float y, guecs::Modifiers mods);
|
bool mouse(float x, float y, guecs::Modifiers mods);
|
||||||
void position_sprite(SpriteTexture& st, const std::string& name, float scale, bool at_mid=false);
|
void position_sprite(SpriteTexture& st, const std::string& name, float scale, bool at_mid=false);
|
||||||
bool boss_dead();
|
bool boss_dead();
|
||||||
|
void run_systems();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
gui/fsm.cpp
12
gui/fsm.cpp
|
|
@ -226,8 +226,18 @@ namespace gui {
|
||||||
event(Event::BOSS_END);
|
event(Event::BOSS_END);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case ATTACK:
|
||||||
|
fmt::println("ATTACK THE BOSS!");
|
||||||
|
break;
|
||||||
|
case MOUSE_MOVE: {
|
||||||
|
sf::Vector2f pos = mouse_position();
|
||||||
|
$boss_fight_ui->mouse(pos.x, pos.y, {1 << guecs::ModBit::hover});
|
||||||
|
} break;
|
||||||
|
case TICK:
|
||||||
|
$boss_fight_ui->run_systems();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break; // do nothing for now
|
fmt::println("BOSS_FIGHT unknown event {}", (int)ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue