25 lines
536 B
TypeScript
25 lines
536 B
TypeScript
import { Vec2 } from "../../common/utils.ts";
|
|
import { CompDisplay } from "../components/display.ts";
|
|
import { CompPos } from "../components/world.ts";
|
|
import { Engine } from "../engine.ts";
|
|
|
|
export class CompEnemy {
|
|
target;
|
|
life;
|
|
constructor() {
|
|
this.target = null as number | null;
|
|
this.life = 10;
|
|
}
|
|
}
|
|
|
|
export function sys_spawn_enemy(pos: Vec2) {
|
|
return (engine: Engine) => {
|
|
return engine.spawn((entity) =>
|
|
entity.insert(
|
|
new CompEnemy(),
|
|
new CompPos(entity, pos),
|
|
new CompDisplay("èé"),
|
|
)
|
|
);
|
|
};
|
|
}
|