-
Notifications
You must be signed in to change notification settings - Fork 0
Creating and controling the game
Tymoteusz Dzienniak edited this page Nov 24, 2016
·
1 revision
import Entropy from 'entropy.js';
const game = Entropy();
// register some comps, ents and sys
game.registerComponent({ ... });
game.registerEntity({
type: 'Ball',
...
});
game.registerSystem({
type: 'Movement',
...
});
// add some ents and systems
game.addEntity('Ball', ...);
game.addEntity('Ball', ...);
game.addSystem('Render');
game.addSystem('Movement');
// start the game
game.start(); // from this point the game loop is running, systems are updating
// stop the game, back to life
game.stop(); // game loop is stopped, no more updates