Wicked-Depths/checkpoint.gd

23 lines
583 B
GDScript

extends CharacterBody2D
@export var checked : bool = false
# 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):
pass
func _on_area_2d_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
if not checked:
if body.name == "plr":
checked = true
get_parent().current = self
$AudioStreamPlayer.play()
$AnimatedSprite2D.play("checked")
SaveHandler.set_setting("checkpoint",self.name)