X-Git-Url: https://git.r.bdr.sh/rbdr/serpentity/blobdiff_plain/f2a4303543b0b0c1a62681c74244176aa778f417..3f00fec5fc38ff34000721903dd94c30ffc864f3:/README.md?ds=inline diff --git a/README.md b/README.md index 50b8f86..f46e132 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Serpentity is a simple entity framework inspired by [Ash][ash]. Usage: - const Serpentity = require('serpentity'); + import Serpentity from '@serpentity/serpentity'; ## Instantiating an engine @@ -29,7 +29,8 @@ Remove entities or systems: 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 @@ -38,7 +39,8 @@ 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; @@ -60,7 +62,8 @@ Systems can refer to entities by requesting nodes. 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; @@ -73,7 +76,8 @@ that comply with that API 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);