extends Node2D

class_name CheckPoint

signal activated

export var activated:=false

func deactivate() -> void:
	activated = false
	$Particles2D.emitting = false
	$AnimationPlayer.play("idle")
	
func activate() -> void:
	if activated: return
	activated = true
	$AnimationPlayer.play("activated")
	$Particles2D.emitting = true
	emit_signal("activated", self)
	
func _on_activated_animation_finished():
	$Particles2D.amount = 5
	$AnimationPlayer.play("active")


func _on_Area2D_body_entered(body: Node) -> void:
	if body.name  == "Player":
		activate()
