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.
This commit is contained in:
parent
abd843d5ec
commit
e2bd61a1e4
2 changed files with 13 additions and 7 deletions
18
gui.cpp
18
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:
|
||||
|
|
2
gui.hpp
2
gui.hpp
|
@ -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…
Add table
Add a link
Reference in a new issue