Skip to content

Commit

Permalink
fix wrong code in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
alan.smithee committed May 24, 2018
1 parent 81e8a55 commit bf3e057
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,25 @@ function movementSystem(entities, { delta }) {
}
}

entityManager.registerLogicSystem('movement', [ pos, vel ], movementSystem)
entityManager.registerLogicSystem([ pos, vel ], movementSystem)

function logSystem(entities) {
for (const {entity} of entities) {
console.log(entity[pos].x, entity[pos].y)
}
}

entityManager.registerRenderSystem('log', [ pos ], logSystem)
entityManager.registerRenderSystem([ pos ], logSystem)

// 3. Run the systems
// 3. Add an entity

entityManager
.build()
.withComponent(pos)
.withComponent(vel)
.create(1)

// 4. Run the systems

entityManager.onLogic({ delta: 16 }) // invokes all logic systems (movementSystem)
entityManager.onRender({ delta: 16 }) // invokes all render systems (logSystem)
Expand Down

0 comments on commit bf3e057

Please sign in to comment.