Player's aim is now updated constantly as they move, just need to solve #57 to complete it. Closes #9.
This commit is contained in:
parent
584c4e9f67
commit
a26f0b0c0a
7 changed files with 48 additions and 27 deletions
18
gui/fsm.cpp
18
gui/fsm.cpp
|
@ -101,14 +101,18 @@ namespace gui {
|
|||
}
|
||||
}
|
||||
|
||||
void FSM::ROTATING(Event ) {
|
||||
if($main_ui.play_rotate()) {
|
||||
void FSM::ROTATING(Event) {
|
||||
if(auto aim = $main_ui.play_rotate()) {
|
||||
auto& player_pos = System::player_position($level);
|
||||
player_pos.aiming_at = *aim;
|
||||
state(State::IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
void FSM::COMBAT_ROTATE(Event ) {
|
||||
if($main_ui.play_rotate()) {
|
||||
void FSM::COMBAT_ROTATE(Event) {
|
||||
if(auto aim = $main_ui.play_rotate()) {
|
||||
auto& player_pos = System::player_position($level);
|
||||
player_pos.aiming_at = *aim;
|
||||
state(State::IN_COMBAT);
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +136,12 @@ namespace gui {
|
|||
void FSM::IDLE(Event ev, std::any data) {
|
||||
using enum Event;
|
||||
|
||||
auto& player_pos = System::player_position($level);
|
||||
|
||||
fmt::println("AIMING AT: {},{}; POS: {},{}",
|
||||
player_pos.aiming_at.x, player_pos.aiming_at.y,
|
||||
player_pos.location.x, player_pos.location.y);
|
||||
|
||||
sound::stop("walk");
|
||||
|
||||
switch(ev) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue