extends Node2D
var time_left = 0.0

# Declare member variables here. Examples:
# var a = 2
# var b = "text"


# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	visible = time_left > 0.0
	time_left -= delta
	time_left = max(time_left, 0.0)
	rotation_degrees = rand_range(-5.0,5.0)
	position = Vector2(rand_range(-10,10), rand_range(-10,10)) + Vector2(384,216)/2
	
	pass

func invert_inverters():
	material.set_shader_param("inverted", !material.get_shader_param("inverted"))
	pass


func _on_Timer_timeout():
	invert_inverters()
	pass # Replace with function body.

func flash_image(image_name, how_long):
	material.set_shader_param("inverted", false)
	$StrobeTimer.start()
	for child in get_children():
		if child.name != "StrobeTimer":
			child.visible = false
	get_node(image_name).visible = true
	time_left = how_long
	pass
