ecsjs

1.2.0 • Public • Published

Entity Component System for Javascript

Pipeline status NPM version NPM downloads

BuyMeACoffee

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

/ecsjs/

    Package Sidebar

    Install

    npm i ecsjs

    Weekly Downloads

    133

    Version

    1.2.0

    License

    GNU GPL v3

    Unpacked Size

    82.6 kB

    Total Files

    22

    Last publish

    Collaborators

    • pflannery