From dad703d9878c624472f6cf71c3b192015af8f9b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n?= <58742147+dip000@users.noreply.github.com> Date: Thu, 17 Feb 2022 15:47:04 -0600 Subject: [PATCH] Multi map reworked Multi maps cannot be outputted yet --- MapBuilderForWeb/BuilderVisuals.js | 33 ++++-- MapBuilderForWeb/MapBuilder.js | 34 +++--- MapBuilderForWeb/MapBuilderForWeb.html | 155 +++++++++++++++---------- MapBuilderForWeb/MapBuilderStyles.css | 49 +++++--- MapBuilderForWeb/MultimapMechanics.js | 5 + MapBuilderForWeb/ShapeBuilder.js | 9 +- 6 files changed, 176 insertions(+), 109 deletions(-) diff --git a/MapBuilderForWeb/BuilderVisuals.js b/MapBuilderForWeb/BuilderVisuals.js index feee945..05b5539 100644 --- a/MapBuilderForWeb/BuilderVisuals.js +++ b/MapBuilderForWeb/BuilderVisuals.js @@ -6,16 +6,17 @@ let value = "646970303030"; var isClicking = false; - function AddHoverListenerToElements(elements){ + function AddHoverListenerToElements(elements, callback){ for(let i=0; i in the and appends into tbl.appendChild(tblBody); body.appendChild(tbl); - tbl.setAttribute("border", "2"); + //tbl.setAttribute("border", "2"); return tbl; } diff --git a/MapBuilderForWeb/MapBuilder.js b/MapBuilderForWeb/MapBuilder.js index 27a8677..a0303da 100644 --- a/MapBuilderForWeb/MapBuilder.js +++ b/MapBuilderForWeb/MapBuilder.js @@ -11,17 +11,19 @@ } - var occupancyMap; const OCCUPIED = true; const FREE = false; const OUT_OF_BOUNDS = 2; const OBSTRUCTED = 3; const MAP_CUT = 4; + const NULL = 5; function GetOccupancyOfPlacingInfo(){ - //If at least one coordenate is occupied, then return occupied - let mapLengthX = occupancyMap.length; - let mapLengthY = occupancyMap[0].length; + + //let mapLengthX = occupancyMap.length; + //let mapLengthY = occupancyMap[0].length; + let occupancyMap = occupancyMaps[currentItemPlacingInfo.level.x][currentItemPlacingInfo.level.y]; + let x = currentItemPlacingInfo.coordenates.x; let y = currentItemPlacingInfo.coordenates.y; @@ -29,7 +31,7 @@ let state = ( occupancyMap[ currentItemPlacingInfo.positionX ][ currentItemPlacingInfo.positionY ] ); if( state == null){ - return MAP_CUT; + return NULL; } if( state == OCCUPIED){ return OCCUPIED; @@ -54,6 +56,7 @@ function UpdateOccupancy(coordenates, state){ + let occupancyMap = occupancyMaps[currentItemPlacingInfo.level.x][currentItemPlacingInfo.level.y]; for(var i=0; i -

Item Type: 0
Rotation: 0
Coordenate: 0 , 0
+

Item Type: 0
Level: 0,0
Rotation: 0
Coordenate: 0 , 0