summaryrefslogtreecommitdiffstats
path: root/src/model/MapData.ts
blob: b83e1463bee4db4b5232ca9600a5e30b3c5220da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
        }
}