feat: implement multiplayer network manager and player movement controller with base game entities and UI

This commit is contained in:
DottsGit
2026-06-06 14:03:57 -04:00
parent 168bd8f1ce
commit 9adbff3968
6 changed files with 120 additions and 24 deletions
+7
View File
@@ -260,6 +260,13 @@ func _ready() -> void:
pl_title.add_theme_constant_override("outline_size", 8)
hl_right.add_child(pl_title)
var port_label = Label.new()
if get_node_or_null("/root/NetworkManager"):
port_label.text = "Port: " + str(get_node("/root/NetworkManager").DEFAULT_PORT)
port_label.add_theme_font_size_override("font_size", 24)
port_label.add_theme_color_override("font_color", Color(0.7, 0.7, 0.7))
hl_right.add_child(port_label)
_host_lobby_players_list = ItemList.new()
_host_lobby_players_list.size_flags_vertical = Control.SIZE_EXPAND_FILL
_host_lobby_players_list.add_theme_font_size_override("font_size", 24)
+14 -8
View File
@@ -51,7 +51,8 @@ func _ready() -> void:
# Killfeed
var kf_margin = MarginContainer.new()
kf_margin.set_anchors_preset(Control.PRESET_TOP_RIGHT)
kf_margin.set_anchors_and_offsets_preset(Control.PRESET_TOP_RIGHT)
kf_margin.grow_horizontal = Control.GROW_DIRECTION_BEGIN
kf_margin.add_theme_constant_override("margin_top", 20)
kf_margin.add_theme_constant_override("margin_right", 20)
add_child(kf_margin)
@@ -164,6 +165,7 @@ func _update_hud() -> void:
var c_name = Label.new()
c_name.text = p_data.get("username", "Player")
c_name.add_theme_font_size_override("font_size", 24)
c_name.add_theme_color_override("font_color", Color(p_data.get("color", "cccccc")))
_scoreboard_grid.add_child(c_name)
var c_k = Label.new()
@@ -188,14 +190,18 @@ func _update_hud() -> void:
_leader_label.text = "Leader: %s (%s Kills)" % [leader_name, max_kills]
func _on_killfeed_event(victim: String, killer: String, weapon: String) -> void:
var l = Label.new()
if killer == "":
l.text = "%s died." % victim
else:
l.text = "%s [%s] %s" % [killer, weapon, victim]
func _on_killfeed_event(victim: String, killer: String, weapon: String, v_color: String = "cccccc", k_color: String = "cccccc") -> void:
var l = RichTextLabel.new()
l.bbcode_enabled = true
l.fit_content = true
l.autowrap_mode = TextServer.AUTOWRAP_OFF
l.add_theme_font_size_override("font_size", 20)
if killer == "":
l.text = "[color=#%s]%s[/color] died." % [v_color, victim]
else:
l.text = "[color=#%s]%s[/color] [%s] [color=#%s]%s[/color]" % [k_color, killer, weapon, v_color, victim]
l.add_theme_font_size_override("normal_font_size", 20)
l.add_theme_color_override("font_outline_color", Color.BLACK)
l.add_theme_constant_override("outline_size", 4)
_killfeed_vbox.add_child(l)