Moving files pre-refactor
This commit is contained in:
33
meta/OverworldScene.gd
Normal file
33
meta/OverworldScene.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
class_name OverworldScene extends Node
|
||||
|
||||
func _enter_tree() -> void:
|
||||
OVERWORLD.mapChanged.connect(onMapChanged)
|
||||
|
||||
func _ready() -> void:
|
||||
onMapChanged(OVERWORLD.newMap, OVERWORLD.playerDestinationNodeName)
|
||||
|
||||
func _exit_tree() -> void:
|
||||
OVERWORLD.mapChanged.disconnect(onMapChanged)
|
||||
|
||||
func onMapChanged(newMap:PackedScene, playerDestinationNodeName:String) -> void:
|
||||
print("New map time.")
|
||||
var map = $Map
|
||||
for childScene in map.get_children():
|
||||
map.remove_child(childScene)
|
||||
|
||||
if !newMap:
|
||||
return
|
||||
|
||||
var newMapInstance = newMap.instantiate()
|
||||
map.add_child(newMapInstance)
|
||||
|
||||
# Find Player.
|
||||
var player = newMapInstance.get_node("Player")
|
||||
var destNode = newMapInstance.get_node(playerDestinationNodeName)
|
||||
if player && player is Player && destNode:
|
||||
player.global_position = destNode.global_position
|
||||
player.global_rotation.y = destNode.global_rotation.y
|
||||
elif playerDestinationNodeName:
|
||||
push_error("Player, or destination node not found in new map.")
|
||||
|
||||
pass
|
Reference in New Issue
Block a user