extends Node2D var current_shields := 100.0 var max_shields := 100.0 var _hit_flash_timer := 0.0 func _process(delta: float) -> void: visible = current_shields > 0.0 if not visible: return _hit_flash_timer = maxf(0.0, _hit_flash_timer - delta) queue_redraw() func set_shield_values(current: float, maximum: float) -> void: current_shields = current max_shields = maxf(1.0, maximum) visible = current_shields > 0.0 queue_redraw() func flash_hit() -> void: _hit_flash_timer = 0.22 queue_redraw() func _draw() -> void: if current_shields <= 0.0: return var shield_ratio := clampf(current_shields / max_shields, 0.0, 1.0) var pulse := 0.035 + (sin(float(Time.get_ticks_msec()) * 0.004) + 1.0) * 0.018 var flash := clampf(_hit_flash_timer / 0.22, 0.0, 1.0) draw_circle(Vector2.ZERO, 35.0, Color(0.12, 0.72, 1.0, pulse + flash * 0.08)) draw_arc( Vector2.ZERO, 36.0, 0.0, TAU, 64, Color(0.35, 0.84, 1.0, 0.3 + shield_ratio * 0.25 + flash * 0.45), 2.0 + flash * 2.0 ) for arc_index in 3: var start_angle := float(arc_index) * TAU / 3.0 + 0.2 draw_arc( Vector2.ZERO, 40.0, start_angle, start_angle + 0.72, 16, Color(0.28, 0.78, 1.0, 0.28 + flash * 0.55), 1.5 + flash )