diff --git a/scenes/HUD.tscn b/scenes/HUD.tscn index 72952cf..f963207 100644 --- a/scenes/HUD.tscn +++ b/scenes/HUD.tscn @@ -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 diff --git a/scripts/HUD.gd b/scripts/HUD.gd index 0825950..936749d 100644 --- a/scripts/HUD.gd +++ b/scripts/HUD.gd @@ -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 + diff --git a/scripts/networking.gd b/scripts/networking.gd index 0b81804..5d1b09c 100644 --- a/scripts/networking.gd +++ b/scripts/networking.gd @@ -29,6 +29,12 @@ func create_server(port, maxPlayers): rpc_id(new_peer_id, "add_previously_connected_player_characters", connected_peers) 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): @@ -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):