This commit is contained in:
Elizabeth Hunt 2024-03-07 22:55:41 -07:00
parent ebae24f5a3
commit ea6c1eef48
Signed by: simponic
GPG Key ID: 52B3774857EB24B1
3 changed files with 2 additions and 36 deletions

View File

@ -7,6 +7,6 @@ import { LevelNames } from ".";
import { LevelSelection, Tutorial, Level } from ".";
export const LEVELS: Level[] = [new LevelSelection(), new Tutorial()];
export const LEVEL_PROGRESSION = {
export const LEVEL_PROGRESSION: Record<string, string[]> = {
[LevelNames.LevelSelection]: [LevelNames.Tutorial],
};

View File

@ -1,4 +1,4 @@
import { Entity } from "../entities";
// import { Entity } from "../entities";
// TODO
//export const levelFormatToEntityList = (lines: string[]): Entity[] => {

View File

@ -1,34 +0,0 @@
import { System, SystemNames } from ".";
import { Game } from "..";
import { ComponentNames, Grid, GridSpawn } from "../components";
import { FunctionBox } from "../entities";
export class GridSpawner extends System {
constructor() {
super(SystemNames.GridSpawner);
}
public update(_dt: number, game: Game) {
game.forEachEntityWithComponent(ComponentNames.GridSpawn, (entity) => {
const lambdaSpawn = entity.getComponent<GridSpawn>(
ComponentNames.GridSpawn,
)!;
const hasGrid = entity.hasComponent(SystemNames.Grid);
if (!lambdaSpawn.direction || !hasGrid) {
return;
}
const grid = entity.getComponent<Grid>(SystemNames.Grid)!;
const lambda = new FunctionBox(grid.gridPosition, lambdaSpawn.code);
const lambdaGrid = lambda.getComponent<Grid>(SystemNames.Grid)!;
lambdaGrid.movingDirection = lambdaSpawn.direction;
lambda.addComponent(lambdaGrid);
game.addEntity(lambda);
lambdaSpawn.direction = null;
entity.addComponent(lambdaSpawn);
});
}
}