Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-06-17 18:27:41 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-06-17 18:27:41 -0700
commite627dfc3a9254c4aed5f26bd16aa4647035b5c8a (patch)
treefcbdd999e3767bf48d2505823acb9386fa405ea7 /src/radial.js
parent5e05d00197bc617128a596c881e40c117c90055e (diff)
Add a building
Diffstat (limited to 'src/radial.js')
-rw-r--r--src/radial.js36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/radial.js b/src/radial.js
index 1b015e9..5a9f875 100644
--- a/src/radial.js
+++ b/src/radial.js
@@ -168,9 +168,11 @@ const buildingCoords = [
generateRadialCoordsRect({ rows: 8, columns: 4, odd: true }, { q: 4, r: 3, s: -7 }),
generateRadialCoordsRect({ rows: 8, columns: 4, odd: true }, { q: -5, r: 3, s: 2 }),
generateRadialCoordsRect({ rows: 6, columns: 3, equal: false }, { q: -12, r: 3, s: 9 }),
- generateRadialCoordsRect({ rows: 8, columns: 4 }, { q: 10, r: 3, s: -13 }),
- generateRadialCoordsRect({ rows: 3, columns: 1 }, { q: 9, r: 7, s: -16 }),
- generateRadialCoordsRect({ rows: 5, columns: 1, odd: true }, { q: 5, r: 6, s: -11 }),
+
+ // hex building
+ // generateRadialCoordsRect({ rows: 8, columns: 4 }, { q: 10, r: 3, s: -13 }),
+ // generateRadialCoordsRect({ rows: 3, columns: 1 }, { q: 9, r: 7, s: -16 }),
+ // generateRadialCoordsRect({ rows: 5, columns: 1, odd: true }, { q: 5, r: 6, s: -11 }),
]
buildingCoords.forEach(building => building.forEach(coords => grid.delete(coords)));
@@ -214,5 +216,29 @@ drawHexes(elevation1, grid);
buildings.appendChild(bldElevationBasement);
buildings.appendChild(bldElevation1);
buildings.appendChild(bldElevation2);
-svg.appendChild(elevation1);
-svg.appendChild(buildings);
+
+const buildingBlah = svg.querySelector('#building2');
+
+const bld2grid = document.createElementNS(xmlns, 'g');
+drawHexes(bld2grid, generateRadialCoordsRect({ rows: 9, columns: 4, odd: true, equal: false }, { q: 4, r: -4, s: 0 }));
+drawHexes(bld2grid, generateRadialCoordsRect({ rows: 5, columns: 1 }, { q: 3, r: -1, s: -2 }));
+drawHexes(bld2grid, generateRadialCoordsRect({ rows: 5, columns: 1, odd: true }, { q: -2, r: -1, s: 3 }));
+
+const bld2elvBasement = bld2grid.cloneNode(true);
+bld2elvBasement.classList.add('elevation-basement');
+buildingBlah.querySelector('.floor').after(bld2elvBasement);
+
+const bld2elv1 = bld2grid.cloneNode(true);
+bld2elv1.classList.add('elevation-1');
+bld2elvBasement.after(bld2elv1);
+
+const bld2elv2 = bld2grid.cloneNode(true);
+bld2elv2.classList.add('elevation-2');
+bld2elv1.after(bld2elv2);
+
+const bld2elvRoof = bld2grid.cloneNode(true);
+bld2elvRoof.classList.add('elevation-roof');
+bld2elv2.after(bld2elvRoof);
+
+buildingBlah.before(elevation1);
+buildingBlah.before(buildings);