This commit is contained in:
Paul Black 2023-03-06 19:07:22 -07:00
parent 50d3c7c895
commit 9fed334b5d
5 changed files with 13 additions and 11 deletions

View file

@ -50,7 +50,6 @@ offset_left = 15.0
offset_top = 11.0
offset_right = 136.0
offset_bottom = 37.0
text = "Player 1: 0"
horizontal_alignment = 1
[node name="player2Label" type="Label" parent="."]
@ -59,7 +58,6 @@ offset_left = 15.0
offset_top = 34.0
offset_right = 136.0
offset_bottom = 60.0
text = "Player 2: 0"
horizontal_alignment = 1
[node name="player3Label" type="Label" parent="."]
@ -68,7 +66,6 @@ offset_left = 15.0
offset_top = 57.0
offset_right = 136.0
offset_bottom = 83.0
text = "Player 3: 0"
horizontal_alignment = 1
[node name="player4Label" type="Label" parent="."]
@ -77,7 +74,6 @@ offset_left = 15.0
offset_top = 80.0
offset_right = 136.0
offset_bottom = 106.0
text = "Player 4: 0"
horizontal_alignment = 1
[node name="player5Label" type="Label" parent="."]
@ -86,7 +82,6 @@ offset_left = 15.0
offset_top = 103.0
offset_right = 136.0
offset_bottom = 129.0
text = "Player 5: 0"
horizontal_alignment = 1
[node name="player6Label" type="Label" parent="."]
@ -95,7 +90,6 @@ offset_left = 15.0
offset_top = 126.0
offset_right = 136.0
offset_bottom = 152.0
text = "Player 6: 0"
horizontal_alignment = 1
[node name="player7Label" type="Label" parent="."]
@ -104,7 +98,6 @@ offset_left = 15.0
offset_top = 149.0
offset_right = 136.0
offset_bottom = 175.0
text = "Player 7: 0"
horizontal_alignment = 1
[node name="player8Label" type="Label" parent="."]
@ -113,7 +106,6 @@ offset_left = 15.0
offset_top = 172.0
offset_right = 136.0
offset_bottom = 198.0
text = "Player 8: 0"
horizontal_alignment = 1
[node name="player9Label" type="Label" parent="."]
@ -122,7 +114,6 @@ offset_left = 15.0
offset_top = 195.0
offset_right = 136.0
offset_bottom = 221.0
text = "Player 9: 0"
horizontal_alignment = 1
[node name="player10Label" type="Label" parent="."]
@ -131,7 +122,6 @@ offset_left = 15.0
offset_top = 218.0
offset_right = 145.0
offset_bottom = 244.0
text = "Player 10: 0"
horizontal_alignment = 1
[node name="timerPanel" type="Panel" parent="."]

View file

@ -11,7 +11,7 @@ func _ready():
func _process(delta):
if deathTimer < 100:
deathTimer = deathTimer + 10 * delta
deathTimer = deathTimer + (10 * Global.respawnTimeModifier) * delta
if deathTimer > 100:
deathTimer = 0
Global.playerPleaseRespawn = true # Used so the Teddy script will know to reset variables and position of the player

View file

@ -24,6 +24,7 @@ var HUDStartLabelText = "" # The text displayed at the bottom of the screen of t
var lastPersonToHitMe = 0 # Defined in the Bullet RPC
var HUDPlayerDied = false # Tells the HUD.gd script that a point should be added or deducted
var connectedPlayers = [] # Currently connected players by their name (NOT THEIR ID)
var respawnTimeModifier = 1.0 # Affects how quickly the player respawns in death.gd
func _process(delta):
if godMode:

View file

@ -44,6 +44,12 @@ func _on_start_button_pressed():
Networking.add_player_node(1)
Global.connectedPlayers += [Global.playerName]
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
if $normalRespawn.button_pressed == true:
Global.respawnTimeModifier = 1.0
elif $shortRespawn.button_pressed == true:
Global.respawnTimeModifier = 2
elif $longRespawn.button_pressed == true:
Global.respawnTimeModifier = 0.5
else:
$mapSelected.text = "NO MAX PLAYERS SELECTED"
else:

View file

@ -24,6 +24,7 @@ func create_server(port, maxPlayers):
rpc("add_newly_connected_player_character", new_peer_id)
rpc_id(new_peer_id, "add_previously_connected_player_characters", connected_peers)
rpc_id(new_peer_id, "sync_names", Global.connectedPlayers)
rpc_id(new_peer_id, "sync_respawn_speed", Global.respawnTimeModifier)
add_player_node(new_peer_id)
)
@ -69,3 +70,7 @@ func sync_names(connectedPlayers):
func sync_name_all_peers(name):
Global.connectedPlayers += [name]
print(Global.connectedPlayers)
@rpc("any_peer", "reliable")
func sync_respawn_speed(speed):
Global.respawnTimeModifier = speed