start Multiplayer

This commit is contained in:
2023-01-15 23:59:12 +01:00
parent 5cfc0839f7
commit 1ef5d54d6c
11 changed files with 209 additions and 255 deletions

27
Game.gd
View File

@@ -1,35 +1,31 @@
extends Node3D
class_name Game
@onready var label : Label = $CanvasLayer/Label
@onready var player : CharacterBody3D = $PlayerQ3
signal game_loaded
var init_config
func _ready():
func load_map():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
var config = Runtimeloader.loadConfig("init.cfg") as ConfigFile
init_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):
for map_list in init_config.get_section_keys("MAPS"):
for map in init_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):
for weapons_list in init_config.get_section_keys("WEAPONS"):
for weapon in init_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)
game_loaded.emit()
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:
@@ -39,3 +35,4 @@ func _input(event):
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
elif event.keycode == KEY_ESCAPE:
get_tree().quit()