summaryrefslogtreecommitdiffstats
path: root/src/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/model')
-rw-r--r--src/model/MapData.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/model/MapData.ts b/src/model/MapData.ts
new file mode 100644
index 0000000..b83e146
--- /dev/null
+++ b/src/model/MapData.ts
@@ -0,0 +1,26 @@
+import {mapFromObject} from '../util';
+
+
+interface Input {
+ tiles: {[key: string]: string};
+ collision: string[];
+ layers: string[][][];
+}
+
+export default class MapData {
+ tiles: Map<string, string>;
+ collision: string[];
+ layers: string[][][];
+
+ width: number;
+ height: number;
+
+ constructor(data: Input) {
+ this.tiles = mapFromObject(data.tiles);
+ this.collision = data.collision;
+ this.layers = data.layers;
+
+ this.height = this.collision.length;
+ this.width = this.collision[0].length;
+ }
+}