24 lines
534 B
GDScript
24 lines
534 B
GDScript
class_name Exit
|
|
extends Node2D
|
|
|
|
@export
|
|
var area: Area2D
|
|
|
|
@export
|
|
var victory_scene: PackedScene
|
|
|
|
func _ready() -> void:
|
|
area.body_entered.connect(self._on_body_entered)
|
|
$Area2D.connect("body_entered",Callable(self,"on_collide"))
|
|
|
|
func _on_body_entered(body: PhysicsBody2D) -> void:
|
|
if body is Player:
|
|
MusicPlayer.stop()
|
|
MusicPlayer.stream = load("res://Music/DOS-88/Smooth Sailing.ogg")
|
|
MusicPlayer.volume_db = 0
|
|
MusicPlayer.play()
|
|
SaveManager.change_upgrade_points(1)
|
|
get_tree().change_scene_to_packed(victory_scene)
|
|
|
|
|