extends Area2D const sound = preload('res://assets/sounds/save.wav') # Called when the node enters the scene tree for the first time. func _ready(): body_entered.connect(on_body_entered) $sound_player.finished.connect(on_sound_finished) func on_body_entered(body): if body.is_in_group('player'): g_game_state.checkpoint(body.global_position) $sound_player.play_sound({"asset": sound, "volume": 0}) func on_sound_finished(): queue_free()