30 lines
580 B
GDScript
30 lines
580 B
GDScript
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.amount = 200
|
|
$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()
|