Fixed #32
This commit is contained in:
parent
3c6ac9dbdd
commit
4e694e55ef
2 changed files with 34 additions and 7 deletions
|
@ -21,6 +21,9 @@ func _process(delta):
|
|||
$startLabel.text = Global.HUDStartLabelText
|
||||
$Fatigue.value = Global.fatigue
|
||||
$Health.value = Global.playerHealth
|
||||
if Input.is_action_just_pressed("start_game"):
|
||||
restart_round()
|
||||
rpc("restart_round")
|
||||
if Global.mapName == "Tutorial":
|
||||
tutorial()
|
||||
if not Global.tutorialComplete:
|
||||
|
@ -49,8 +52,6 @@ func _process(delta):
|
|||
print("RUNNER IS DEAD")
|
||||
rpc("runner_dead", Global.chosenRunner)
|
||||
runner_dead(Global.chosenRunner)
|
||||
if Global.mapName == "Tutorial":
|
||||
pass
|
||||
roundTimer -= delta
|
||||
minutes = roundTimer / 60
|
||||
seconds = fmod(roundTimer, 60)
|
||||
|
@ -58,7 +59,11 @@ func _process(delta):
|
|||
if roundTimer <= 0.0:
|
||||
if not roundOver:
|
||||
roundOver = true
|
||||
Global.HUDStartLabelText = "GAME OVER"
|
||||
Global.roundInSession = false
|
||||
if Global.gamemode == "Deathmatch":
|
||||
Global.HUDStartLabelText = "GAME OVER"
|
||||
elif Global.gamemode == "Runner":
|
||||
Global.HUDStartLabelText = "RUNNER WINS"
|
||||
play_audio(load("res://sounds/buzzer.mp3"))
|
||||
if Global.HUDPlayerDied:
|
||||
Global.HUDPlayerDied = false
|
||||
|
@ -67,10 +72,12 @@ func _process(delta):
|
|||
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]:
|
||||
var numlabel = i + 1
|
||||
get_node("player" + str(numlabel) + "Label").text = Global.connectedPlayers[i] + ": " + "0"
|
||||
if not roundOver:
|
||||
for i in range(Global.connectedPlayers.size()):
|
||||
if Global.connectedPlayers[i]:
|
||||
var numlabel = i + 1
|
||||
get_node("player" + str(numlabel) + "Label").text = Global.connectedPlayers[i] + ": " + "0"
|
||||
roundTimer = Global.roundTimer
|
||||
|
||||
@rpc("any_peer", "reliable")
|
||||
func update_scores(name):
|
||||
|
@ -137,6 +144,21 @@ func sync_runner_hp(value):
|
|||
func killed_text(killer, killed):
|
||||
$killedLabel.text = killer + " killed " + killed
|
||||
|
||||
@rpc("any_peer", "reliable")
|
||||
func restart_round():
|
||||
for i in range(Global.connectedPlayers.size()):
|
||||
if Global.connectedPlayers[i]:
|
||||
var numlabel = i + 1
|
||||
get_node("player" + str(numlabel) + "Label").text = Global.connectedPlayers[i] + ": " + "0"
|
||||
roundOver = false
|
||||
scoresInitalized = false
|
||||
$Health.max_value = 100
|
||||
Global.playerHealth = 100
|
||||
if Global.gamemode == "Runner":
|
||||
Global.chosenRunner = null
|
||||
runnerSelected = false
|
||||
Global.iAmRunner = false
|
||||
Global.runnerDead = false
|
||||
|
||||
### TUTORIAL STUFF ###
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ func create_server(port, maxPlayers):
|
|||
rpc_id(new_peer_id, "sync_respawn_speed", Global.respawnTimeModifier)
|
||||
rpc_id(new_peer_id, "sync_gamemode", Global.gamemode)
|
||||
rpc_id(new_peer_id, "sync_mapName", Global.mapName)
|
||||
rpc_id(new_peer_id, "sync_roundTimer", Global.roundTimer)
|
||||
rpc("add_newly_connected_player_character", new_peer_id)
|
||||
rpc_id(new_peer_id, "add_previously_connected_player_characters", connected_peers)
|
||||
add_player_node(new_peer_id)
|
||||
|
@ -101,6 +102,10 @@ func sync_mapName(map):
|
|||
func sync_mapPath(path):
|
||||
Global.currentMapPath = path
|
||||
|
||||
@rpc("any_peer", "reliable")
|
||||
func sync_roundTimer(time):
|
||||
Global.roundTimer = time
|
||||
|
||||
@rpc("any_peer", "reliable")
|
||||
func check_name(name): # Returns true if it finds a matching name
|
||||
for i in range(Global.connectedPlayers.size()):
|
||||
|
|
Loading…
Reference in a new issue