40 lines
1.4 KiB
GDScript
40 lines
1.4 KiB
GDScript
extends Area3D
|
|
|
|
@onready var Player: CharacterBody3D = get_tree().get_first_node_in_group("Player")
|
|
@export var warp_point: Vector3
|
|
|
|
var the_mess
|
|
|
|
func _on_body_entered(body: Node3D) -> void:
|
|
if body.is_in_group("player"):
|
|
##Get the file name of the current level
|
|
Global.warp_from = get_tree().current_scene.scene_file_path
|
|
##Find correct next level
|
|
match self.name:
|
|
"ToCampus":
|
|
print("schoolhouse rock")
|
|
Global.next_scene = "res://scenes/levels/campus.tscn"
|
|
"ToSnowHouse":
|
|
print("It's snowing somewhere")
|
|
Global.next_scene = "res://scenes/levels/snow_house.tscn"
|
|
"ToWaterway":
|
|
print("Drinking under the moonlight")
|
|
Global.next_scene = "res://scenes/levels/drunken_waterway.tscn"
|
|
"ToGrunge":
|
|
Global.next_scene = "res://scenes/levels/grunge_world.tscn"
|
|
"ToHauntedHouse":
|
|
Global.next_scene = "res://scenes/levels/gag_haunted_house.tscn"
|
|
"ToCruelCalculus":
|
|
Global.next_scene = "res://scenes/levels/cruel_calculus.tscn"
|
|
"ToGardenLights":
|
|
Global.next_scene = "res://scenes/levels/garden_of_lights.tscn"
|
|
|
|
## GOTO loading screen
|
|
get_tree().change_scene_to_file.call_deferred("res://scenes/menus/loading_screen.tscn")
|
|
|
|
##Cleanup the debris so it does not load into the next scene
|
|
## Might need to call deffered the litter if load times get bad
|
|
the_mess = get_tree().get_nodes_in_group("mess")
|
|
for litter in the_mess:
|
|
litter.queue_free()
|