UI and other changes

This commit is contained in:
Forrest 2026-10-07 13:41:38 -04:00
parent 87b5c11fcf
commit 215e24e246
79 changed files with 70023 additions and 2201 deletions

View file

@ -1,6 +1,6 @@
class_name RadarHud
extends Control
## Top-right minimap, under ResourceHud's materials readout (Task #8): the playable farm's
## Top-right minimap, under PhaseHud's day and time (Task #8): the playable farm's
## outline scaled into a small panel, a white dot for the local scarecrow, and one dot per alive
## enemy within GameConfig.radar_range meters of it, colored by type. Hidden unless the Radar
## upgrade is bought (Upgrades.owned(state, "radar")); like the Alien Ray, it's a hidden shed item
@ -8,12 +8,11 @@ extends Control
## GameConfig.radar_refresh seconds rather than every frame, matching the "sweep" feel of a radar
## rather than a live camera.
## Panel size, and its offset from the screen's top-right corner (below ResourceHud, which uses
## roughly the top 120 px of that corner: PhaseHud/AssetHud/ScarecrowHud/CoopHud leave the rest of
## the right side clear).
## Panel size, and its offset from the screen's top-right corner (MARGIN_TOP when there's no
## PhaseHud; else just under its widget and hint, PhaseHud.bottom()).
const MAP_SIZE := Vector2(190.0, 190.0)
const MARGIN_RIGHT := 24.0
const MARGIN_TOP := 140.0
const MARGIN_TOP := 150.0
const DOT_RADIUS := 4.0
const PLAYER_RADIUS := 5.0
## thief (alien), crow, breaker (alien robot), ufo: EnemySystem.TYPE_*.
@ -40,9 +39,7 @@ func _ready() -> void:
mouse_filter = Control.MOUSE_FILTER_IGNORE
_title = Label.new()
_title.text = "Radar"
_title.add_theme_font_size_override("font_size", 18)
_title.add_theme_color_override("font_outline_color", Color.BLACK)
_title.add_theme_constant_override("outline_size", 6)
Sketch.style(_title, 22, Sketch.TEXT, 6)
_title.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(_title)
@ -51,7 +48,10 @@ func _process(delta: float) -> void:
visible = sim != null and sim.campaign != null and Upgrades.owned(sim.campaign.state, "radar")
if not visible:
return
_title.position = _rect().position + Vector2(10.0, 6.0)
var at := _rect().position + Vector2(10.0, 0.0)
if at != _title.position:
_title.position = at
queue_redraw() # moved with PhaseHud's hint
_refresh_left -= delta
if _refresh_left <= 0.0:
_refresh()
@ -87,10 +87,9 @@ func _draw() -> void:
if not visible:
return
var r := _rect()
draw_rect(r, Color(0.0, 0.0, 0.0, 0.42))
Sketch.box(self, r, Sketch.WASH, Color(0, 0, 0, 0), 0.0, 501.0)
var inner := Rect2(r.position + Vector2(10.0, 30.0), r.size - Vector2(20.0, 40.0))
draw_rect(inner, Color(0.08, 0.14, 0.08, 0.85))
draw_rect(inner, Color(0.5, 0.7, 0.5, 0.6), false, 1.5)
Sketch.box(self, inner, Color(0.08, 0.14, 0.08, 0.85), Color(0.6, 0.8, 0.6, 0.7), 2.0, 502.0)
if sim == null or sim.zones == null:
return
var playable: Rect2 = sim.zones.playable
@ -111,4 +110,5 @@ static func _to_map(inner: Rect2, playable: Rect2, world: Vector2) -> Vector2:
func _rect() -> Rect2:
return Rect2(Vector2(size.x - MARGIN_RIGHT - MAP_SIZE.x, MARGIN_TOP), MAP_SIZE)
var top := sim.phase_hud.bottom() + 8.0 if sim != null and sim.phase_hud != null else MARGIN_TOP
return Rect2(Vector2(size.x - MARGIN_RIGHT - MAP_SIZE.x, top), MAP_SIZE)