Implement simple map renderer
This commit is contained in:
parent
a5e69edc5a
commit
02758a69ac
13 changed files with 259 additions and 74 deletions
26
src/model/MapData.ts
Normal file
26
src/model/MapData.ts
Normal 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;
|
||||
}
|
||||
}
|
Reference in a new issue