extends AnimatedSprite


var activated = false
var targetx = 0
var targety = 0
var target = null

export var radius = 50
export var speed = 60


func _ready():
	$Range/CollisionShape2D.scale = Vector2(radius, radius)

func _draw():
	draw_circle(Vector2(0,0),radius,Color(1,1,1,0.2))

func _on_Area2D_body_entered(body):
	if body.is_in_group("player"):
		stats.take_damage(500)
		
		
func aggro(body):
	print("hmm")
	if body.is_in_group("player"):
		activated = true
		target = body

func _process(delta):
	if activated and target != null:
		var velocity = (target.position - position).normalized() * speed * delta
		position += velocity


func _on_SpeedUpTimer_timeout():
	speed += speed*0.05
