Limited Space
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
ld54/nodes/triggers/checkpoint.gd

16 lines
449 B

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()