From f9322831f95a4a15db5eff67cc0701466cfc3784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Sch=C3=B6ttl?= Date: Fri, 3 Jan 2020 02:00:21 +0100 Subject: [PATCH] Add basic map rendering --- src/lib/index.js | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/src/lib/index.js b/src/lib/index.js index 436cb2a..37a3f55 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -1,6 +1,88 @@ console.log('import entrypoint lib') +const cos_60 = Math.cos(60 * Math.PI / 180) +const sin_60 = Math.sin(60 * Math.PI / 180) + +const TileType = { + LAND : 0, + WATER : 1 +} + +class TileGrid { + constructor(width = 100, height = 100) { + this.width = 100 + this.height = 100 + this.tiles = new Array(this.width * this.height) + for (let y=0; y