model: add mutable MapState (empty for now)
This commit is contained in:
parent
ebc56db63c
commit
bc6d79b088
5 changed files with 25 additions and 17 deletions
25
src/model/data/MapData.ts
Normal file
25
src/model/data/MapData.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import {mapFromObject} from '../../util';
|
||||
|
||||
interface Input {
|
||||
readonly tiles: {[key: string]: string};
|
||||
readonly collision: string[];
|
||||
readonly layers: string[][][];
|
||||
}
|
||||
|
||||
export default class MapData {
|
||||
public readonly tiles: Map<string, string>;
|
||||
public readonly collision: string[];
|
||||
public readonly layers: string[][][];
|
||||
|
||||
public readonly width: number;
|
||||
public readonly 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;
|
||||
}
|
||||
}
|
Reference in a new issue