@gamelegends/thatre
v1.0.0
Published
***Simple api ๐***: Perfect, even for starters <br> ***Scalable ๐***: Best game architecture <br> ***Typescript ready๐***: support for typescript <br> ***Pluggable ๐***: create plugins to add ecs to all possible libraries
Downloads
8
Readme
Sword โ
The pluggable ๐ ecs (entity component system)๐ฆ to rule them all!
Features
Simple api ๐: Perfect, even for starters Scalable ๐: Best game architecture Typescript ready๐: support for typescript Pluggable ๐: create plugins to add ecs to all possible libraries
Example
export class ThreeRenderComponent extends Behaviour {
object : any;
constructor(object? : any){
super('threeInstance')
this.object = object ?? new THREE.Object3D();
}
onAwake(gameObject: GameObject){
gameObject.binded = this.object;
}
}
export class SceneAdderComponent extends Behaviour {
scene : THREE.Scene;
constructor({scene}: {scene: THREE.Scene} | any){
super('scene-adder')
this.scene = scene ?? new THREE.Scene();
}
onAwake(gameObject: GameObject): void {
this.scene.add(gameObject.binded)
}
}
class Rotation extends Behaviour {
constructor(){
super('rotation')
}
update(gameObject: GameObject, _delta: number): void {
gameObject.binded.rotation.y += 0.01;
}
}
let actor = new Actor({})
let scene = new GameScene({});
actor.addBehaviour(new ThreeRenderComponent());
scene.addPlugin({three: new SceneAdderComponent({})});
actor.addBehaviour(new Rotation());
function animate() {
let delta = requestAnimationFrame(animate)
scene.update(delta);
}
animate()
why?
there is no why. Just joking, Game development is not easy... this library from sword ecosystem might help you 'fastify' the game creation process
License
Yes guys, it's MIT licensed