0.1.0 • Published 9 years ago

ecstasy v0.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

ecstasy

Build Status Coverage Status

A fast Entity-Component-System framework for Javascript.

Additonally it supports Action and Turns - it's really useful when you're making turn based strategy game or multiplayer game.

Documentation

You can find quick reference here. You can find jsdoc documentation here.

Examples

Simple Example

var Engine = require('ecstasy').Engine;
var engine = new Engine();

// Define components
engine.c('pos', function PositionComponent(options) {
  this.x = options.x || 0;
  this.y = options.y || 0;
});
engine.c('vel', function VelocityComponent(options) {
  this.x = options.x || 0;
  this.y = options.y || 0;
});

// Define systems
engine.s('vel', {
  add: function(engine) {
    this.engine = engine;
    this.entities = engine.e('pos', 'vel');
  },
  update: function(delta) {
    this.entities.forEach(function(entity) {
      entity.c('pos').x += entity.c('vel').x;
      entity.c('pos').y += entity.c('vel').y;
    });
  }
});

// Define entities
engine.e({
  pos: {x: 200, y: 200},
  vel: {x: 3, y: 3}
});

setInterval(function() {
  engine.update(12);
}, 12);
0.1.0

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago