23 lines
577 B
GDScript
23 lines
577 B
GDScript
extends Control
|
|
class_name ReloadRing
|
|
|
|
var progress: float = 0.0:
|
|
set(val):
|
|
progress = clampf(val, 0.0, 1.0)
|
|
queue_redraw()
|
|
|
|
var radius: float = 16.0
|
|
var thickness: float = 4.0
|
|
var color: Color = Color(1.0, 1.0, 1.0, 0.8)
|
|
|
|
func _draw() -> void:
|
|
if progress <= 0.0 or progress >= 1.0:
|
|
return
|
|
|
|
# Draw background arc (darker)
|
|
draw_arc(Vector2.ZERO, radius, 0, PI * 2.0, 32, Color(0, 0, 0, 0.4), thickness, true)
|
|
|
|
# Draw progress arc
|
|
var end_angle = -PI / 2.0 + (PI * 2.0 * progress)
|
|
draw_arc(Vector2.ZERO, radius, -PI / 2.0, end_angle, 32, color, thickness, true)
|