From: Ben Beltran Date: Mon, 9 Mar 2020 18:24:02 +0000 (-0500) Subject: Update usage in README X-Git-Tag: 3.0.0^2~2 X-Git-Url: https://git.r.bdr.sh/rbdr/serpentity/commitdiff_plain/efee4ba168340dbb22e65f0f63f04e609cc07117?hp=4d4216690096dc8d300254e8752a4830df1c0f2d Update usage in README --- 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);