WIP checkpoint: PC2: Basic visible player character representation
This commit is contained in:
@@ -20,18 +20,19 @@ func _run() -> void:
|
|||||||
await process_frame
|
await process_frame
|
||||||
print("SMOKE: loading test level scene")
|
print("SMOKE: loading test level scene")
|
||||||
|
|
||||||
# Load the test level scene (which includes the player).
|
# Load the test level scene (which includes the player). Use the same
|
||||||
|
# SceneTree API as the real game so `current_scene` is populated before
|
||||||
|
# the scene is added and its _ready() callbacks fire. That ordering is
|
||||||
|
# what the player's spawn lookup (get_tree().current_scene) depends on.
|
||||||
var packed: PackedScene = load("res://scenes/worlds/test_level.tscn")
|
var packed: PackedScene = load("res://scenes/worlds/test_level.tscn")
|
||||||
var level: Node3D = packed.instantiate()
|
var result := change_scene_to_packed(packed)
|
||||||
|
if result != OK:
|
||||||
|
printerr("SMOKE: failed to change scene, error ", result)
|
||||||
|
quit(1)
|
||||||
|
return
|
||||||
|
|
||||||
# Order matters: set_current_scene() requires the node's parent to already
|
await scene_changed
|
||||||
# be root, so add_child() must come first. This mirrors what a real
|
var level: Node3D = current_scene as Node3D
|
||||||
# change_scene_to_packed() does at runtime.
|
|
||||||
root.add_child(level)
|
|
||||||
current_scene = level
|
|
||||||
|
|
||||||
print("SMOKE: level instantiated, waiting for ready")
|
|
||||||
await level.ready
|
|
||||||
print("SMOKE: level ready")
|
print("SMOKE: level ready")
|
||||||
|
|
||||||
# 1. Verify the player node exists in the scene tree.
|
# 1. Verify the player node exists in the scene tree.
|
||||||
|
|||||||
Reference in New Issue
Block a user