summaryrefslogtreecommitdiffstats
path: root/src/controller
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2018-11-11 20:31:22 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2018-11-11 20:31:22 +0100
commitec0e51231f95b4d847e4e94eb7146d3a0c159512 (patch)
tree8f14cdd4790b4fefe78d1f1db41cc7d9bb263520 /src/controller
parente77b54f01b86f095363ee5217f7179a38b324c63 (diff)
downloadrpgedit-ec0e51231f95b4d847e4e94eb7146d3a0c159512.tar
rpgedit-ec0e51231f95b4d847e4e94eb7146d3a0c159512.zip
Prepare support for adding extra elements to map layers
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);