X-Git-Url: https://git.r.bdr.sh/rbdr/serpentity/blobdiff_plain/b3b840f89948d96aa28760fc5cf41c384488f6a6..refs/heads/rbdr-use-module-syntax:/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);