diff --git a/gui.cpp b/gui.cpp index 3f7df2b..1b3337d 100644 --- a/gui.cpp +++ b/gui.cpp @@ -143,11 +143,17 @@ namespace gui { } void FSM::ATTACKING(Event ev) { - fmt::println("ATTACKING! {}", $rotation); switch(ev) { - case Event::ATTACK: - run_systems(); - $rotation = $rotation < 0.0f ? 0.0f : -33.0f; + case Event::TICK: + $rotation_count++; + + // just do 10 ticks + if($rotation_count % 10 == 0) { + run_systems(); + $rayview.$anim.play(true); + $rotation = -10.0f; + state(State::IDLE); + } break; default: state(State::IDLE); @@ -162,7 +168,6 @@ namespace gui { void FSM::IDLE(Event ev) { using FU = Event; - $rotation = -10.0f; switch(ev) { case FU::QUIT: @@ -193,8 +198,7 @@ namespace gui { state(State::MAPPING); break; case FU::ATTACK: - fmt::println("ATTACK IN IDLE!"); - draw_weapon(); + $rotation = -30.0f; state(State::ATTACKING); break; case FU::CLOSE: diff --git a/gui.hpp b/gui.hpp index 95b60b2..f1cba24 100644 --- a/gui.hpp +++ b/gui.hpp @@ -52,6 +52,8 @@ namespace gui { class FSM : public DeadSimpleFSM { public: + // ZED: these two will go away soon + int $rotation_count = 0; float $rotation = -10.0f; Point $player{0,0}; LevelManager $levels;