0.0.3 • Published 1 year ago

@mantou/ecs v0.0.3

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

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 {}
0.0.3

1 year ago

0.0.1

1 year ago