Let the jank FLOW through my veins like pure cocaine! We have animations now and can attack enemies. It's all garbage to replace next session but the idea is there.

master
Zed A. Shaw 4 weeks ago
parent abd843d5ec
commit e2bd61a1e4
  1. 18
      gui.cpp
  2. 2
      gui.hpp

@ -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:

@ -52,6 +52,8 @@ namespace gui {
class FSM : public DeadSimpleFSM<State, Event> {
public:
// ZED: these two will go away soon
int $rotation_count = 0;
float $rotation = -10.0f;
Point $player{0,0};
LevelManager $levels;

Loading…
Cancel
Save