extends Position2D

onready var global: Node = get_node("/root/Global")

var a
var b
var c

var pulse: float = 0
var pulse_length: float
#var color: Color = global.Palette.yellow
var color: Color = Color("d4f5b0")

var length = 24

func _ready():
	randomize()

func _process(delta):
	pulse += 40 * delta
	if pulse > length+20:
		pulse = -10
		pulse_length = (a * 10) + 3
		global.play_sound("blip")
	update()

func _draw():
#	draw_circle(Vector2(5, 5), 5, Color.white)
	for i in range(length):
		var j = i+1
		
		if i > pulse && i < pulse+pulse_length: 
			draw_line( \
				Vector2(i, b*sin(c*i)), \
				Vector2(j, b*sin(c*j)), \
				color, 1)
