diff options
-rw-r--r-- | play.js | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -485,29 +485,39 @@ function update_map() { } } + for (let hex = 0; hex < stack.length; ++hex) { + let start_x = ui.hex_x[hex] + let start_y = ui.hex_y[hex] + + if (stack[hex] === ui.focus) { + let height = stack[hex].length * 56 + if (start_y + height + 25 > 960) + start_y = 960 - height + 25 + } + for (let i = 0; i < stack[hex].length; ++i) { let u = stack[hex][i] let e = ui.units[u] let x, y, z if (stack[hex] === ui.focus) { - x = ui.hex_x[hex] - 25 - y = ui.hex_y[hex] - 25 + i * 56 + x = start_x - 25 + y = start_y - 25 + i * 56 z = 100 } else { if (stack[hex].length <= 1) { - x = ui.hex_x[hex] - 25 + i * 11 - y = ui.hex_y[hex] - 25 + i * 14 + x = start_x - 25 + i * 11 + y = start_y - 25 + i * 14 } else if (stack[hex].length <= 4) { - x = ui.hex_x[hex] - 30 + i * 11 - y = ui.hex_y[hex] - 30 + i * 14 + x = start_x - 30 + i * 11 + y = start_y - 30 + i * 14 } else if (stack[hex].length <= 8) { - x = ui.hex_x[hex] - 30 + i * 4 - y = ui.hex_y[hex] - 30 + i * 4 + x = start_x - 30 + i * 4 + y = start_y - 30 + i * 4 } else { - x = ui.hex_x[hex] - 35 + i * 3 - y = ui.hex_y[hex] - 35 + i * 3 + x = start_x - 35 + i * 3 + y = start_y - 35 + i * 3 } z = 1 + i } |