Battler

Concept

by Sam Fereday

JavaScript

/// Battler Module
// State Machine Component
var StateMachine = function() {};

// Event Queue Component
var EventQueue = function() {};

// Storyboard Manager Component
var StoryBoardManager = function() {};

// App entry and main controller
var Battler = function() {

	this.FSM = new StateMachine();

};

/// ...
// Data Definitions
var definitions = {
  instant: 0,
  animation: 1
}

var actions = {
  approach: 0,
  attack: 1,
  return: 2,
  damage: 3
}

// Test cases
var actorData = {
    player: {
      actions: {
        attackCycle: [{
          action: actions.approach,
          type: definitions.animation,
          t: 0.2
        }, {
          action: actions.attack,
          type: definitions.animation,
          t: 0.1
        }, {
          action: actions.damage,
          type: definitions.instant,
          t: -1
        }, {
          action: actions.return,
          type: definitions.animation,
          t: 0.2
        }]
      }
    },
    enemy: {}
  },
  sceneConfig = {};