Randoloot/scripts/game/combat_flash.gd
2026-10-10 23:07:57 +02:00

24 lines
621 B
GDScript

extends Node2D
var flash_color := Color("77e8bc")
var _age := 0.0
const DURATION := 0.45
func _ready() -> void:
z_index = 25
func _process(delta: float) -> void:
_age += delta
if _age >= DURATION:
queue_free()
else:
queue_redraw()
func _draw() -> void:
var progress := _age / DURATION
var color := Color(flash_color, 1.0 - progress)
draw_arc(Vector2.ZERO, 24 + progress * 36, 0, TAU, 48, color, 3.0 * (1.0 - progress) + 1.0, true)
for index in 6:
var direction := Vector2.RIGHT.rotated(TAU * index / 6.0)
draw_line(direction * (20 + progress * 20), direction * (30 + progress * 42), color, 2.0, true)