Banana Animations
Animating the Banana
The Banana has only the Idle state.
// -----
// --- Add: Includes. ---
#include "engine/fsm.h"
#include "engine/sprite_sheet_animation.h"
#include "engine/state.h"
// --- End ---
class Banana : public ng::Node {
// -----
protected:
// -----
void Update() override; // Add: Update method.
private:
// --- Add: Context and Banana states. ---
struct Context {};
class IdleState : public ng::State<Context> {
public:
IdleState(ng::State<Context>::ID id, ng::SpriteSheetAnimation animation);
protected:
void OnEnter() override;
void Update() override;
private:
ng::SpriteSheetAnimation animation_;
};
// --- End ---
// -----
// --- Add: Context and FSM. ---
Context context_;
ng::FSM<Context> animator_;
// --- End ---
};Last updated