@mantou/ecs
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

ECS

A simple JavaScript ECS library for NESBox Sandbox

Example

const helloWorld = (world) => {
  console.log('hello');
  for (const entity of world.getEntitiesIter()) {
    if (entity.hasComponent(SizeComponent)) {
      // do something...
    }
  }
};

const world = new World(256, 240)
  .addEntity(new BasicEntity().addComponent(new SizeComponent(10, 10)))
  .addSystem(helloWorld);

world.getVideoFrame();
world.getAudioFrame();
world.getState();

Custom Component:

@registerComponent()
export class NewPieceComponent extends Component {}

Readme

Keywords

none

Package Sidebar

Install

npm i @mantou/ecs

Weekly Downloads

1

Version

0.0.3

License

none

Unpacked Size

27.9 kB

Total Files

9

Last publish

Collaborators

  • mantou132