This commit is contained in:
Paul Black 2023-03-16 23:40:33 -06:00
parent ac6919e31e
commit 8049377263
3 changed files with 32 additions and 8 deletions

View file

@ -127,20 +127,21 @@ horizontal_alignment = 1
[node name="timerPanel" type="Panel" parent="."]
layout_mode = 0
offset_left = 476.0
offset_top = 41.0
offset_right = 674.0
offset_bottom = 116.0
offset_left = 448.0
offset_top = 38.0
offset_right = 646.0
offset_bottom = 113.0
scale = Vector2(1.16, 1)
[node name="timer" type="Label" parent="."]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -91.0
offset_top = 54.0
offset_right = 91.0
offset_bottom = 107.0
offset_left = -106.0
offset_top = 52.0
offset_right = 106.0
offset_bottom = 105.0
grow_horizontal = 2
theme_override_fonts/font = ExtResource("3_x1wqt")
theme_override_font_sizes/font_size = 60
@ -189,6 +190,7 @@ offset_right = 1131.0
offset_bottom = 82.0
[node name="Health" type="ProgressBar" parent="RunnerPanel"]
visible = false
modulate = Color(0.890196, 0.137255, 0.0156863, 1)
layout_mode = 0
offset_left = 5.0
@ -206,3 +208,11 @@ offset_top = 6.0
offset_right = 161.0
offset_bottom = 32.0
text = "Runner Health"
[node name="killedLabel" type="Label" parent="."]
layout_mode = 0
offset_left = 353.0
offset_top = 130.0
offset_right = 769.0
offset_bottom = 156.0
horizontal_alignment = 1

View file

@ -52,6 +52,8 @@ func _process(delta):
Global.HUDPlayerDied = false
rpc("update_scores", Global.lastPersonToHitMe)
update_scores(Global.lastPersonToHitMe)
rpc("killed_text", Global.lastPersonToHitMe, Global.playerName)
killed_text(Global.lastPersonToHitMe, Global.playerName)
if Global.roundInSession == false:
for i in range(Global.connectedPlayers.size()):
if Global.connectedPlayers[i]:
@ -120,3 +122,8 @@ func runner_dead(runner):
@rpc("any_peer", "reliable")
func sync_runner_hp(value):
$RunnerPanel/Health.value = value
@rpc("any_peer", "reliable")
func killed_text(killer, killed):
$killedLabel.text = killer + " killed " + killed

View file

@ -30,6 +30,12 @@ func create_server(port, maxPlayers):
add_player_node(new_peer_id)
)
### NOT WORKING YET
peer.peer_disconnected.disconnect(
func(peer_id):
rpc("disconnect_peer", peer_id)
)
func load_map(map):
Global.multiplayerCurrent = true
@ -62,6 +68,7 @@ func add_previously_connected_player_characters(peer_ids):
@rpc
func disconnect_peer(peer_id):
peer_id.queue_free()
print(peer_id, " has disconnected!")
@rpc("any_peer", "reliable")
func sync_names(connectedPlayers):