extends Path


export var pointscale = 2
export var speed = 20

var pointcount = 0
var firstpoint = Vector3(0,0,0)

var aggro = false
var target = null

func _ready():
	for point in $Points.get_children():
		pointcount += 1
		if pointcount == 1:
			firstpoint = point.translation*pointscale
		curve.add_point(point.translation*pointscale)
		
	curve.add_point(firstpoint)
	
	
	curve.interpolate(4,0.5)

func _physics_process(delta):
		$PathFollow.set_offset($PathFollow.get_offset() + speed * delta)


func _on_Aggro_body_entered(body):
	if body != null:
		if body.is_in_group("player"):
			body.take_damage(50)
