OpenLiberty/scripts/map_test.gd

27 lines
815 B
GDScript3
Raw Permalink Normal View History

2022-11-14 20:20:41 +07:00
extends Node
2022-11-14 20:58:49 +07:00
2022-11-20 04:07:41 +07:00
var suzanne := preload("res://prefabs/suzanne.tscn")
2025-03-04 19:36:02 +07:00
var map_loader: MapLoader
2022-11-19 05:06:08 +07:00
2022-11-14 20:58:49 +07:00
func _ready() -> void:
2025-03-04 19:36:02 +07:00
map_loader = MapLoader.new()
add_child(map_loader)
# Connect signals for progress updates
map_loader.loading_progress.connect(_on_loading_progress)
2025-03-05 13:10:38 +07:00
# TODO: Implement a proper loading screen before enabling threaded loading
# For now, load the map directly
var map := map_loader.load_map()
add_child(map)
func _on_loading_progress(progress: float) -> void:
print("Loading: %d%%" % int(progress * 100))
2022-11-20 04:07:41 +07:00
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventKey:
if event.physical_keycode == KEY_SPACE and event.pressed:
var node := suzanne.instantiate() as RigidBody3D
add_child(node)
node.global_position = get_viewport().get_camera_3d().global_position