Elemente, Kombos, Fallen, KI mit Vorausschau, Kampagne, Hotseat und Netzwerk, Werkstatt, Erfolge, Tagesaufgaben, Tests und Exporte. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QPgKvy5W9WRNFHjkm5QsHx
41 lines
1.2 KiB
GDScript
41 lines
1.2 KiB
GDScript
class_name BattleLayout
|
|
## Feste Bildschirmaufteilung des Kampfes (1280x800).
|
|
|
|
const SIZES := {1: [110, 110, 10], 2: [96, 110, 8], 3: [78, 100, 4], 4: [54, 72, 4], 5: [44, 62, 3]}
|
|
const HAND_W := 130
|
|
const HAND_H := 185
|
|
const HAND_GAP := 8
|
|
const BAR := Rect2(335, 415, 610, 68)
|
|
const OWN_X := (1280 - 5 * 110 - 4 * 10) / 2
|
|
|
|
|
|
static func compact(n_others: int) -> bool:
|
|
return n_others >= 4
|
|
|
|
|
|
static func hero_box_rect(n_others: int, i: int) -> Rect2:
|
|
var col_w := 1280 / n_others
|
|
var margin := 6 if compact(n_others) else 10
|
|
return Rect2(i * col_w + margin, 10, col_w - 2 * margin, 64)
|
|
|
|
|
|
static func own_slot(j: int) -> Rect2:
|
|
return Rect2(OWN_X + j * 120, 250, 110, 140)
|
|
|
|
|
|
static func other_slot(n_others: int, i: int, j: int) -> Rect2:
|
|
var col_w := 1280 / n_others
|
|
var sz: Array = SIZES[n_others]
|
|
var bx: int = i * col_w + (col_w - 5 * sz[0] - 4 * sz[2]) / 2
|
|
return Rect2(bx + j * (sz[0] + sz[2]), 84, sz[0], sz[1])
|
|
|
|
|
|
static func hand_rect(count: int, i: int) -> Rect2:
|
|
var total := count * HAND_W + maxi(0, count - 1) * HAND_GAP
|
|
var x := (1280 - total) / 2
|
|
return Rect2(x + i * (HAND_W + HAND_GAP), 800 - HAND_H - 8, HAND_W, HAND_H)
|
|
|
|
|
|
static func trap_rect(i: int) -> Rect2:
|
|
return Rect2(400 + i * 78, 490, 70, 98)
|