Implement simple map renderer

This commit is contained in:
Matthias Schiffer 2017-09-12 09:20:19 +02:00
parent a5e69edc5a
commit 02758a69ac
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
13 changed files with 259 additions and 74 deletions

26
src/model/MapData.ts Normal file
View file

@ -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;
}
}