summaryrefslogtreecommitdiff
path: root/src/engine/systems/Level.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth@simponic.xyz>2025-03-01 13:10:21 -0700
committerElizabeth Hunt <elizabeth@simponic.xyz>2025-03-01 13:10:21 -0700
commit309ed20627ed798c464a9f97d9c32ceb1a314595 (patch)
treeb98d7ec6f6dd3eb3bcc4eaaaf76035ad9a2671a0 /src/engine/systems/Level.ts
parent8dacee8f73633131fd68935c1e2493dc4beec837 (diff)
downloadthe-abstraction-engine-309ed20627ed798c464a9f97d9c32ceb1a314595.tar.gz
the-abstraction-engine-309ed20627ed798c464a9f97d9c32ceb1a314595.zip
add a reset button!
Diffstat (limited to 'src/engine/systems/Level.ts')
-rw-r--r--src/engine/systems/Level.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/engine/systems/Level.ts b/src/engine/systems/Level.ts
index 87e12a5..824895d 100644
--- a/src/engine/systems/Level.ts
+++ b/src/engine/systems/Level.ts
@@ -3,8 +3,8 @@ import { Game } from "..";
import { type Level as LevelType, LEVELS, LEVEL_PROGRESSION } from "../levels";
export class Level extends System {
- private unlockedLevels: Set<string>;
- private currentLevel: LevelType | null;
+ private unlockedLevels: Set<string> = new Set();
+ private currentLevel: LevelType | null = null;
private moveToLevel: string | null;
private levelMap: Map<string, LevelType>;
@@ -16,15 +16,18 @@ export class Level extends System {
this.levelMap.set(level.name, level);
});
- this.currentLevel = null;
this.moveToLevel = initialLevel;
- this.unlockedLevels = new Set();
}
public setLevel(level: string) {
this.moveToLevel = level;
}
+ public reset(game: Game) {
+ game.resetState();
+ this.currentLevel?.init(game);
+ }
+
public update(_dt: number, game: Game) {
if (this.moveToLevel === this.currentLevel?.name || !this.moveToLevel) {
return;