43 lines
1.3 KiB
GDScript
43 lines
1.3 KiB
GDScript
extends Node3D
|
|
class_name Game
|
|
|
|
@onready var label : Label = $CanvasLayer/Label
|
|
@onready var player : CharacterBody3D = $PlayerQ3
|
|
|
|
|
|
func _ready():
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
|
|
var config = Runtimeloader.loadConfig("init.cfg") as ConfigFile
|
|
|
|
print("Loading PCK...")
|
|
for map_list in config.get_section_keys("MAPS"):
|
|
for map in config.get_value("MAPS", map_list):
|
|
Runtimeloader.loadPCK(map)
|
|
|
|
for weapons_list in config.get_section_keys("WEAPONS"):
|
|
for weapon in config.get_value("WEAPONS", weapons_list):
|
|
Runtimeloader.loadPCK(weapon)
|
|
|
|
print("Loading Resources Done.")
|
|
|
|
Runtimeloader.loadScene("maps/test_map.tscn", self)
|
|
#Runtimeloader.get_all_entities(node)
|
|
|
|
|
|
func _process(_delta):
|
|
label.text = "H Velocity: %3.2f" % [Vector2(player.velocity.x, player.velocity.z).length()]
|
|
label.text += "\nV Velocity: %3.2f" % [player.velocity.y]
|
|
label.text += "\nOn floor: %s" % player.is_on_floor()
|
|
|
|
|
|
func _input(event):
|
|
if event is InputEventKey and event.is_pressed():
|
|
if event.keycode == KEY_F:
|
|
if !DisplayServer.window_get_mode():
|
|
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
|
else:
|
|
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
|
elif event.keycode == KEY_ESCAPE:
|
|
get_tree().quit()
|