summaryrefslogtreecommitdiffstats
path: root/src/controller
diff options
context:
space:
mode:
Diffstat (limited to 'src/controller')
-rw-r--r--src/controller/gamecontext.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/controller/gamecontext.ts b/src/controller/gamecontext.ts
index 9bb87e5..1595b41 100644
--- a/src/controller/gamecontext.ts
+++ b/src/controller/gamecontext.ts
@@ -39,7 +39,7 @@ export class GameContext implements CollidableGroup {
);
}
- private static async loadMap(renderer: Renderer, name: string): Promise<[SpriteView, Collidable[]]> {
+ private static async loadMap(renderer: Renderer, name: string): Promise<[SpriteView[], Collidable[]]> {
const map = new MapData(await getJSON(`resources/map/${name}.json`));
return [await loadMap(renderer, map), mkCollision(map.collision)];
}
@@ -61,7 +61,7 @@ export class GameContext implements CollidableGroup {
private constructor(
private readonly renderer: Renderer,
- private readonly mapView: SpriteView,
+ private readonly mapView: SpriteView[],
private readonly player: EntityContext,
private readonly entities: EntityContext[],
private readonly collision: Collidable[],
@@ -168,7 +168,8 @@ export class GameContext implements CollidableGroup {
this.renderer.setCenter(this.player.pos);
this.renderer.clear();
- this.mapView.render();
+ for (const layer of this.mapView)
+ layer.render();
for (const r of [...this.entities, this.player])
r.render(time);