32 lines
917 B
GDScript
32 lines
917 B
GDScript
extends Line2D
|
|
|
|
var _time := 0.0
|
|
var radiation_beam := false
|
|
|
|
func _ready() -> void:
|
|
# Draw the beam in layers instead of a flat line. No bloom is required.
|
|
default_color = Color.TRANSPARENT
|
|
width = 0.0
|
|
|
|
func _process(delta: float) -> void:
|
|
_time += delta
|
|
if visible:
|
|
queue_redraw()
|
|
|
|
func _draw() -> void:
|
|
if points.size() < 2:
|
|
return
|
|
var pulse := 0.88 + sin(_time * 65.0) * 0.12
|
|
var tint := Color(0.25,1,0.16) if radiation_beam else Color(0.3,0.92,1)
|
|
for i in points.size()-1:
|
|
var start := points[i]
|
|
var end := points[i+1]
|
|
draw_line(start,end,Color(tint,0.09*pulse),16,true)
|
|
draw_line(start,end,Color(tint,0.2*pulse),9,true)
|
|
draw_line(start,end,Color(tint,0.7),3.8,true)
|
|
draw_line(start,end,Color(tint.lightened(0.8),0.96),1.4,true)
|
|
for point in points:
|
|
draw_circle(point,9*pulse,Color(tint,0.12))
|
|
draw_circle(point,4*pulse,Color(tint,0.6))
|
|
draw_circle(point,1.8,tint.lightened(0.8))
|