From 9be9f8e73940f1a38410575557fcd57cc620a8f4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 5 Nov 2018 01:28:35 +0100 Subject: Read collision barriers from map file --- src/model/data/map.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/model') diff --git a/src/model/data/map.ts b/src/model/data/map.ts index d6fd835..4d9ecda 100644 --- a/src/model/data/map.ts +++ b/src/model/data/map.ts @@ -1,11 +1,20 @@ +export interface CollisionPolygon { + readonly type: 'polygon'; + readonly vertices: Array<[number, number]>; +} + +export type Collision = CollisionPolygon; + export interface Input { 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; @@ -13,6 +22,7 @@ export class MapData { constructor(data: Input) { 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; -- cgit v1.2.3