Usage:
- const Serpentity = require('serpentity');
+ import Serpentity from '@serpentity/serpentity';
## Instantiating an engine
Entities are the basic object of Serpentity, and they do nothing.
- const entity = new Serpentity.Entity();
+ import { Entity } from '@serpentity/serpentity';
+ const entity = new Entity();
All the behavior is added through components
Components define data that we can add to an entity. This data will
eventually be consumed by "Systems"
- const PositionComponent = class PositionComponent extends Serpentity.Component {
+ import { Component } from '@serpentity/serpentity';
+ const PositionComponent = class PositionComponent extends Component {
constructor(config) {
this.x = 0;
Nodes are sets of components that you define, so your system can require
entities that always follow the API defined in the node.
- const MovementNode = class MovementNode extends Serpentity.Node;
+ import { Node } from '@serpentity/serpentity';
+ const MovementNode = class MovementNode extends Node;
MovementNode.position = PositionComponent;
MovementNode.motion = MotionComponent;
Systems are called on every update, and they use components through nodes.
- const TestSystem = class TestSystem extends Serpentity.System {
+ import { System } from '@serpentity/serpentity';
+ const TestSystem = class TestSystem extends System {
added(engine){
this.nodeList = engine.getNodes(MovementNode);
Just run `engine.update(dt)` in your game loop :D
-![Travis CI Build Status][travis-ci-badge]
-
[ash]: http://www.ashframework.org/
-[travis-ci-badge]: https://travis-ci.org/serpentity/serpentity.svg?branch=master