ecsjs
v1.3.0
Published
An entity component system library for JavaScript
Maintainers
Readme
Entity Component System for Javascript
An entity component system library for JavaScript
Install
npm install --save ecsjs
Documentation
Examples
Browser
<script type="application/javascript" src="./some-path/ecs.js"></script>
<script>
// define a component
class Position {
constructor(x, y) {
this.x = x
this.y = y
}
}
// register the component
ecs.register(Position)
// create an entity
const entityId = ecs.getNextId()
// add or update the entity data
ecs.set(entityId, new Position(25, 25))
</script>Module import
import { ecs } from 'ecsjs'
// define a component
class Position {
constructor(x, y) {
this.x = x
this.y = y
}
}
// register the component
ecs.register(Position)
// create an entity
const entityId = ecs.getNextId()
// add or update the entity data
ecs.set(entityId, new Position(25, 25))License
Licensed under GNU GPL v3
Copyright © 2013+ contributors

