summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-04-22 22:08:58 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-03 18:48:16 +0200
commit4ee072b305f2d2a23882f40df8b853be501643d9 (patch)
tree4d73144a9b064c1247e6d89d00f1be2f7da6de18 /play.js
parent05e812c325e9fbc8bca497652f5cf77b8ab947e9 (diff)
downloadandean-abyss-4ee072b305f2d2a23882f40df8b853be501643d9.tar.gz
WIP tweak base layout
Diffstat (limited to 'play.js')
-rw-r--r--play.js31
1 files changed, 23 insertions, 8 deletions
diff --git a/play.js b/play.js
index 6cd88e2..6af65e3 100644
--- a/play.js
+++ b/play.js
@@ -634,8 +634,17 @@ function layout_pieces(list, xorig, yorig, bases, s) {
const dy = 11
let off_x = 0
let off_y = 0
+
if (bases && bases.length === 0)
off_y = 25
+
+ if (bases && bases.length > 0) {
+ if (data.spaces[s].type === "mountain")
+ off_x = 20
+ else
+ off_x = -20
+ }
+
function layout_piece_rowcol(nrow, ncol, row, col, e, z) {
// basic piece size = 29x36
let x = xorig - (row * dx - col * dx) - 15 + off_x
@@ -679,15 +688,21 @@ function place_piece(p, x, y, z) {
function layout_dept_bases(list, xc, yc, s) {
if (data.spaces[s].type !== "mountain") {
- if (list.length > 0)
- place_piece(list[0], xc - 20 + 32, yc - 10, 51)
- if (list.length > 1)
- place_piece(list[1], xc - 20 - 32, yc - 10, 52)
+ if (list.length === 1) {
+ place_piece(list[0], xc - 20 + 32, yc - 10, 52)
+ }
+ if (list.length === 2) {
+ place_piece(list[0], xc - 20 + 18, yc - 0, 52)
+ place_piece(list[1], xc - 20 + 18 + 32, yc - 21, 51)
+ }
} else {
- if (list.length > 0)
- place_piece(list[0], xc - 20 - 32, yc - 10, 51)
- if (list.length > 1)
- place_piece(list[1], xc - 20 + 32, yc - 10, 52)
+ if (list.length === 1) {
+ place_piece(list[0], xc - 20 - 32, yc - 10, 52)
+ }
+ if (list.length === 2) {
+ place_piece(list[0], xc - 20 - 18, yc - 0, 52)
+ place_piece(list[1], xc - 20 - 18 - 31, yc - 21, 51)
+ }
}
}