summaryrefslogtreecommitdiffstats
path: root/src/model/data/map.ts
blob: b36f6b51e2abf7077f147b8ede54066333feaf55 (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
import { Collision } from './collision';

export interface MapDataInput {
	readonly tiles: string[];
	readonly layers: number[][][];
	readonly collision: Collision[];
}

export class MapData {
	public readonly tiles: string[];
	public readonly layers: number[][][];
	public readonly collision: Collision[];

	public readonly width: number;
	public readonly height: number;

	constructor(data: MapDataInput) {
		this.tiles = data.tiles;
		this.layers = data.layers;
		this.collision = data.collision;

		this.height = this.layers[0].length;
		this.width = this.layers[0][0].length;
	}
}