2023-01-31 13:34:11 -07:00
|
|
|
extends Control
|
|
|
|
|
2023-03-19 01:35:35 -06:00
|
|
|
var roundTimer = Global.roundTimer
|
2023-03-05 22:08:14 -07:00
|
|
|
var minutes
|
|
|
|
var seconds
|
2023-01-31 13:34:11 -07:00
|
|
|
|
2023-03-06 00:35:22 -07:00
|
|
|
var scores: Array[int] = []
|
|
|
|
var scoresInitalized = false
|
2023-03-28 22:32:49 -06:00
|
|
|
var playerSelected = false
|
2023-03-19 15:06:11 -06:00
|
|
|
var roundOver = false
|
2023-03-28 22:32:49 -06:00
|
|
|
var TraitorPlayersKilled = 0
|
|
|
|
var TTTInnocentDead = false
|
2023-04-04 12:39:23 -06:00
|
|
|
var oldPlayerSize = 0
|
|
|
|
var initalizedPlayerPanelSize = false
|
2023-03-06 00:35:22 -07:00
|
|
|
|
2023-01-31 13:34:11 -07:00
|
|
|
func _ready():
|
2023-03-19 01:35:35 -06:00
|
|
|
await get_tree().create_timer(0.1).timeout
|
|
|
|
roundTimer = Global.roundTimer
|
2023-03-05 22:08:14 -07:00
|
|
|
minutes = roundTimer / 60
|
|
|
|
seconds = fmod(roundTimer, 60)
|
|
|
|
$timer.text = "%02d:%02d" % [minutes, seconds]
|
2023-01-31 13:34:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
func _process(delta):
|
2023-03-05 22:08:14 -07:00
|
|
|
$startLabel.text = Global.HUDStartLabelText
|
2023-02-02 13:28:14 -07:00
|
|
|
$Fatigue.value = Global.fatigue
|
|
|
|
$Health.value = Global.playerHealth
|
2023-05-26 23:13:55 -06:00
|
|
|
if roundOver:
|
|
|
|
if Input.is_action_just_pressed("start_game"):
|
|
|
|
print("Player with authority ID of " + str(Global.teddyAuthorityID) + " attempted to restart the round!")
|
|
|
|
if Global.teddyAuthorityID == 1:
|
|
|
|
restart_round()
|
|
|
|
rpc("restart_round")
|
2023-03-19 01:35:35 -06:00
|
|
|
if Global.mapName == "Tutorial":
|
2023-05-05 13:05:54 -06:00
|
|
|
if not Global.playerDisable:
|
|
|
|
tutorial()
|
|
|
|
if not Global.tutorialComplete:
|
|
|
|
$musicPanel.visible = false
|
2023-05-12 23:26:38 -06:00
|
|
|
if Global.iAmSpecial and Global.gamemode == "Runner":
|
|
|
|
rpc("sync_runner_hp", $Health.value)
|
2023-03-11 18:50:43 -07:00
|
|
|
if Global.musicUpdated == true:
|
|
|
|
Global.musicUpdated = false
|
|
|
|
$musicPanel/playingLabel.text = Global.musicName
|
|
|
|
$musicPanel/authorLabel.text = Global.musicAuthor
|
|
|
|
$musicPanel.visible = true
|
|
|
|
await get_tree().create_timer(3).timeout
|
|
|
|
$musicPanel.visible = false
|
2023-03-05 22:08:14 -07:00
|
|
|
if Global.roundInSession == true and roundTimer >= 0:
|
2023-03-06 00:35:22 -07:00
|
|
|
if scoresInitalized == false:
|
|
|
|
scoresInitalized = true
|
|
|
|
fill_scores_with_zeros(Global.connectedPlayers.size())
|
2023-03-16 21:46:29 -06:00
|
|
|
if Global.gamemode == "Deathmatch":
|
|
|
|
Global.HUDStartLabelText = ""
|
2023-03-16 13:37:17 -06:00
|
|
|
if Global.gamemode == "Runner":
|
2023-03-16 21:42:32 -06:00
|
|
|
if Global.teddyAuthorityID == 1:
|
2023-03-28 22:32:49 -06:00
|
|
|
if playerSelected == false:
|
|
|
|
playerSelected = true
|
2023-03-16 21:42:32 -06:00
|
|
|
select_runner(Global.connectedPlayers, Global.connectedPlayersByPeerID)
|
2023-03-28 22:32:49 -06:00
|
|
|
if Global.specialDead == true:
|
2023-03-16 13:37:17 -06:00
|
|
|
print("RUNNER IS DEAD")
|
2023-03-28 22:32:49 -06:00
|
|
|
rpc("runner_dead", Global.chosenPlayer)
|
|
|
|
runner_dead(Global.chosenPlayer)
|
|
|
|
if Global.gamemode == "TTT":
|
|
|
|
$connectedPlayers.visible = false
|
|
|
|
if Global.teddyAuthorityID == 1:
|
|
|
|
if playerSelected == false:
|
|
|
|
playerSelected = true
|
|
|
|
select_traitor(Global.connectedPlayers, Global.connectedPlayersByPeerID)
|
|
|
|
if Global.iAmSpecial:
|
|
|
|
if TraitorPlayersKilled >= (Global.connectedPlayers.size() - 1):
|
|
|
|
rpc("traitor_wins")
|
|
|
|
traitor_wins()
|
|
|
|
if Global.iAmDeadAndInnocent:
|
|
|
|
Global.iAmDeadAndInnocent = false
|
|
|
|
TraitorPlayersKilled += 1
|
|
|
|
if Global.specialDead:
|
|
|
|
rpc("traitor_dead")
|
|
|
|
traitor_dead()
|
|
|
|
if Global.iAmDeadAndInnocent and not Global.iAmSpecial:
|
|
|
|
Global.iAmDeadAndInnocent = false
|
|
|
|
if not TTTInnocentDead:
|
|
|
|
TTTInnocentDead = true
|
|
|
|
rpc("innocent_dead")
|
2023-03-05 22:08:14 -07:00
|
|
|
roundTimer -= delta
|
|
|
|
minutes = roundTimer / 60
|
|
|
|
seconds = fmod(roundTimer, 60)
|
|
|
|
$timer.text = "%02d:%02d" % [minutes, seconds]
|
|
|
|
if roundTimer <= 0.0:
|
2023-03-19 15:06:11 -06:00
|
|
|
if not roundOver:
|
|
|
|
roundOver = true
|
2023-03-19 16:00:06 -06:00
|
|
|
Global.roundInSession = false
|
|
|
|
if Global.gamemode == "Deathmatch":
|
|
|
|
Global.HUDStartLabelText = "GAME OVER"
|
|
|
|
elif Global.gamemode == "Runner":
|
|
|
|
Global.HUDStartLabelText = "RUNNER WINS"
|
2023-03-28 22:32:49 -06:00
|
|
|
elif Global.gamemode == "TTT":
|
|
|
|
Global.HUDStartLabelText = "TRAITOR LOOSES"
|
2023-03-19 15:06:11 -06:00
|
|
|
play_audio(load("res://sounds/buzzer.mp3"))
|
2023-03-06 00:35:22 -07:00
|
|
|
if Global.HUDPlayerDied:
|
|
|
|
Global.HUDPlayerDied = false
|
|
|
|
rpc("update_scores", Global.lastPersonToHitMe)
|
|
|
|
update_scores(Global.lastPersonToHitMe)
|
2023-03-16 23:40:33 -06:00
|
|
|
rpc("killed_text", Global.lastPersonToHitMe, Global.playerName)
|
|
|
|
killed_text(Global.lastPersonToHitMe, Global.playerName)
|
2023-05-27 16:49:09 -06:00
|
|
|
if Global.AIKilled:
|
|
|
|
Global.AIKilled = false
|
|
|
|
update_scores(Global.playerName)
|
|
|
|
killed_text(Global.playerName, "AI")
|
2023-03-06 00:35:22 -07:00
|
|
|
if Global.roundInSession == false:
|
2023-03-19 16:00:06 -06:00
|
|
|
if not roundOver:
|
|
|
|
for i in range(Global.connectedPlayers.size()):
|
2023-04-25 11:32:46 -06:00
|
|
|
if i <= 9:
|
|
|
|
if Global.connectedPlayers[i]:
|
|
|
|
var numlabel = i + 1
|
|
|
|
get_node("connectedPlayers/player" + str(numlabel) + "Label").text = Global.connectedPlayers[i] + ": " + "0"
|
2023-03-19 16:00:06 -06:00
|
|
|
roundTimer = Global.roundTimer
|
2023-04-04 12:39:23 -06:00
|
|
|
if oldPlayerSize != Global.connectedPlayers.size():
|
|
|
|
oldPlayerSize = Global.connectedPlayers.size()
|
|
|
|
if not Global.connectedPlayers.size() > 10:
|
|
|
|
if initalizedPlayerPanelSize == false:
|
|
|
|
initalizedPlayerPanelSize = true
|
|
|
|
for i in Global.connectedPlayers.size():
|
|
|
|
$connectedPlayers.size.y += 26
|
|
|
|
else:
|
|
|
|
$connectedPlayers.size.y += 26
|
2023-03-06 00:35:22 -07:00
|
|
|
|
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func update_scores(name):
|
|
|
|
for i in range(Global.connectedPlayers.size()):
|
2023-03-06 20:24:39 -07:00
|
|
|
if Global.connectedPlayers[i] == str(name):
|
2023-03-06 00:35:22 -07:00
|
|
|
var numlabel = i + 1
|
|
|
|
var currentScore = scores[i] + 1
|
|
|
|
scores[i] += 1
|
2023-04-25 11:32:46 -06:00
|
|
|
if numlabel <= 10:
|
|
|
|
get_node("connectedPlayers/player" + str(numlabel) + "Label").text = Global.connectedPlayers[i] + ": " + str(currentScore)
|
2023-03-06 20:24:39 -07:00
|
|
|
else:
|
|
|
|
print("Name ", i, " wasn't found in the list!")
|
2023-03-06 00:35:22 -07:00
|
|
|
|
|
|
|
func fill_scores_with_zeros(num_of_players):
|
|
|
|
scores.resize(num_of_players)
|
2023-04-25 11:32:46 -06:00
|
|
|
if num_of_players <= 10:
|
|
|
|
for i in num_of_players:
|
|
|
|
scores[i] = 0
|
2023-03-16 13:37:17 -06:00
|
|
|
|
|
|
|
func select_runner(players, playersID):
|
|
|
|
var numOfPlayers = players.size()
|
|
|
|
var getIndexSize = numOfPlayers - 1
|
|
|
|
var playerChosen = RandomNumberGenerator.new().randi_range(0, getIndexSize)
|
|
|
|
var runner = players[playerChosen]
|
2023-03-28 22:32:49 -06:00
|
|
|
Global.chosenPlayer = runner
|
2023-03-16 13:37:17 -06:00
|
|
|
rpc("selected_runner", runner)
|
|
|
|
selected_runner(runner)
|
2023-03-16 21:42:32 -06:00
|
|
|
var runnerID = playersID[playerChosen]
|
2023-03-16 13:37:17 -06:00
|
|
|
if runnerID == 1:
|
|
|
|
runner_stats()
|
|
|
|
else:
|
|
|
|
rpc_id(runnerID, "runner_stats")
|
|
|
|
print("Runner: ", runner, ", ID: ", runnerID)
|
|
|
|
|
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func selected_runner(player):
|
2023-03-16 21:42:32 -06:00
|
|
|
print(Global.connectedPlayersByPeerID)
|
2023-03-28 22:32:49 -06:00
|
|
|
Global.chosenPlayer = player
|
2023-03-16 21:42:32 -06:00
|
|
|
if Global.playerName != player:
|
|
|
|
not_runner(player)
|
2023-03-16 13:37:17 -06:00
|
|
|
|
|
|
|
func not_runner(player):
|
|
|
|
$RunnerPanel.visible = true
|
2023-05-23 11:12:38 -06:00
|
|
|
$killedLabel.visible = false
|
2023-03-16 13:37:17 -06:00
|
|
|
Global.HUDStartLabelText = str(player + " is the runner!")
|
|
|
|
|
2023-04-04 12:39:23 -06:00
|
|
|
var runnerHealth = 0
|
|
|
|
|
2023-03-16 13:37:17 -06:00
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func runner_stats():
|
|
|
|
await get_tree().create_timer(0.1).timeout
|
2023-03-28 22:32:49 -06:00
|
|
|
Global.iAmSpecial = true
|
2023-04-04 12:39:23 -06:00
|
|
|
for i in Global.connectedPlayers.size():
|
|
|
|
runnerHealth += 500
|
|
|
|
$Health.max_value = runnerHealth
|
|
|
|
Global.playerHealth = runnerHealth
|
2023-03-16 13:37:17 -06:00
|
|
|
Global.HUDStartLabelText = "You are the runner!"
|
|
|
|
$RunnerPanel.visible = false
|
|
|
|
print(Global.HUDStartLabelText)
|
2023-04-04 12:39:23 -06:00
|
|
|
print("Runner created with ", runnerHealth, " health!")
|
2023-05-16 09:48:25 -06:00
|
|
|
var map = Global.currentMapNode.get_path()
|
|
|
|
var playerID = Global.teddyAuthorityID
|
|
|
|
var gun = get_node(str(map) + '/' + str(playerID) + '/CollisionShape3D/Neck/Camera3D/Gun')
|
|
|
|
gun.visible = false
|
2023-04-04 12:39:23 -06:00
|
|
|
rpc("sync_runner_health", runnerHealth)
|
|
|
|
|
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func sync_runner_health(health):
|
|
|
|
$RunnerPanel/Health.max_value = health
|
2023-03-16 13:37:17 -06:00
|
|
|
|
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func runner_dead(runner):
|
|
|
|
Global.roundInSession = false
|
|
|
|
Global.HUDStartLabelText = "Runner has died! Killers win!"
|
|
|
|
|
2023-03-28 22:32:49 -06:00
|
|
|
func select_traitor(players, playersID):
|
|
|
|
var numOfPlayers = players.size()
|
|
|
|
var getIndexSize = numOfPlayers - 1
|
|
|
|
var playerChosen = RandomNumberGenerator.new().randi_range(0, getIndexSize)
|
|
|
|
var traitor = players[playerChosen]
|
|
|
|
Global.chosenPlayer = traitor
|
|
|
|
rpc("selected_traitor", traitor)
|
|
|
|
selected_traitor(traitor)
|
|
|
|
var traitorID = playersID[playerChosen]
|
|
|
|
if traitorID == 1:
|
|
|
|
traitor()
|
|
|
|
else:
|
|
|
|
rpc_id(traitorID, "traitor")
|
|
|
|
print("Traitor: ", traitor, ", ID: ", traitorID)
|
|
|
|
|
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func selected_traitor(player):
|
|
|
|
print(Global.connectedPlayersByPeerID)
|
|
|
|
Global.chosenPlayer = player
|
|
|
|
if Global.playerName != player:
|
|
|
|
not_traitor()
|
|
|
|
|
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func traitor():
|
|
|
|
await get_tree().create_timer(0.1).timeout
|
|
|
|
Global.iAmSpecial = true
|
|
|
|
Global.HUDStartLabelText = "You are the traitor!"
|
|
|
|
|
|
|
|
func not_traitor():
|
|
|
|
Global.HUDStartLabelText = str("You are innocent!")
|
|
|
|
|
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func innocent_dead():
|
|
|
|
Global.iAmDeadAndInnocent = true
|
|
|
|
|
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func traitor_wins():
|
|
|
|
Global.roundInSession = false
|
|
|
|
Global.HUDStartLabelText = "Traitor wins! Round is over!"
|
|
|
|
|
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func traitor_dead():
|
|
|
|
Global.roundInSession = false
|
|
|
|
Global.HUDStartLabelText = "Traitor is dead! Innocents win!"
|
|
|
|
|
2023-03-16 13:37:17 -06:00
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func sync_runner_hp(value):
|
|
|
|
$RunnerPanel/Health.value = value
|
2023-03-16 23:40:33 -06:00
|
|
|
|
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func killed_text(killer, killed):
|
|
|
|
$killedLabel.text = killer + " killed " + killed
|
2023-03-19 01:35:35 -06:00
|
|
|
|
2023-03-19 16:00:06 -06:00
|
|
|
@rpc("any_peer", "reliable")
|
|
|
|
func restart_round():
|
|
|
|
for i in range(Global.connectedPlayers.size()):
|
|
|
|
if Global.connectedPlayers[i]:
|
|
|
|
var numlabel = i + 1
|
2023-03-28 22:32:49 -06:00
|
|
|
get_node("connectedPlayers/player" + str(numlabel) + "Label").text = Global.connectedPlayers[i] + ": " + "0"
|
|
|
|
$connectedPlayers.visible = true
|
2023-03-19 16:00:06 -06:00
|
|
|
scoresInitalized = false
|
|
|
|
$Health.max_value = 100
|
|
|
|
Global.playerHealth = 100
|
2023-03-28 22:32:49 -06:00
|
|
|
Global.chosenPlayer = null
|
|
|
|
playerSelected = false
|
|
|
|
Global.iAmSpecial = false
|
|
|
|
Global.specialDead = false
|
|
|
|
Global.iAmDeadAndInnocent = false
|
2023-05-16 09:48:25 -06:00
|
|
|
var map = Global.currentMapNode.get_path()
|
|
|
|
var playerID = Global.teddyAuthorityID
|
|
|
|
var gun = get_node(str(map) + '/' + str(playerID) + '/CollisionShape3D/Neck/Camera3D/Gun')
|
|
|
|
gun.visible = true
|
|
|
|
roundOver = false
|
2023-05-12 23:56:15 -06:00
|
|
|
Global.roundInSession = true
|
2023-05-16 09:48:25 -06:00
|
|
|
|
|
|
|
func gun_visible(status):
|
|
|
|
var map = Global.currentMapNode.get_path()
|
|
|
|
var playerID = Global.teddyAuthorityID
|
|
|
|
var gun = get_node(str(map) + '/' + str(playerID) + '/CollisionShape3D/Neck/Camera3D/Gun')
|
|
|
|
if status == true:
|
|
|
|
gun.visible = false
|
|
|
|
elif status == false:
|
|
|
|
gun.visible = true
|
2023-03-19 01:35:35 -06:00
|
|
|
|
|
|
|
### TUTORIAL STUFF ###
|
|
|
|
|
2023-03-19 13:56:40 -06:00
|
|
|
|
|
|
|
|
|
|
|
var audio_stream_player = AudioStreamPlayer.new()
|
2023-03-19 01:35:35 -06:00
|
|
|
var w = false
|
|
|
|
var a = false
|
|
|
|
var s = false
|
|
|
|
var d = false
|
|
|
|
var ran_timer = false
|
|
|
|
var stage1 = false
|
|
|
|
|
|
|
|
func tutorial():
|
|
|
|
if not stage1:
|
|
|
|
stage1 = true
|
|
|
|
$TutorialPanel/camera.visible = false
|
|
|
|
$TutorialPanel/Mouse.visible = false
|
|
|
|
$TutorialPanel/Arrow_up.visible = false
|
|
|
|
$TutorialPanel/Arrow_left.visible = false
|
|
|
|
$TutorialPanel/Arrow_down.visible = false
|
|
|
|
$TutorialPanel/Arrow_right.visible = false
|
|
|
|
$TutorialPanel/shoot.visible = false
|
|
|
|
$TutorialPanel/Leftmouse.visible = false
|
|
|
|
$TutorialPanel/start.visible = false
|
|
|
|
$TutorialPanel/enter.visible = false
|
|
|
|
$TutorialPanel/EnterKey.visible = false
|
|
|
|
$TutorialPanel/learning.visible = false
|
|
|
|
$TutorialPanel/aim.visible = false
|
|
|
|
$TutorialPanel/timer.visible = false
|
|
|
|
$TutorialPanel/zero.visible = false
|
|
|
|
$TutorialPanel/done.visible = false
|
|
|
|
|
|
|
|
$TutorialPanel.visible = true
|
|
|
|
$TutorialPanel/welcome.visible = true
|
|
|
|
$TutorialPanel/move.visible = true
|
|
|
|
$TutorialPanel/Wasd.visible = true
|
2023-04-04 11:15:40 -06:00
|
|
|
$connectedPlayers/player1Label.text = Global.playerName
|
2023-03-19 01:35:35 -06:00
|
|
|
Global.HUDStartLabelText = " "
|
2023-03-19 13:56:40 -06:00
|
|
|
play_audio(load("res://voice/tutorial/tutorial_1.mp3"))
|
2023-03-19 01:35:35 -06:00
|
|
|
if not w:
|
|
|
|
if Input.is_action_just_pressed("player_forward"):
|
|
|
|
w = true
|
|
|
|
$TutorialPanel/W.visible = true
|
|
|
|
if not a:
|
|
|
|
if Input.is_action_just_pressed("player_left"):
|
|
|
|
a = true
|
|
|
|
$TutorialPanel/A.visible = true
|
|
|
|
if not s:
|
|
|
|
if Input.is_action_just_pressed("player_backward"):
|
|
|
|
s = true
|
|
|
|
$TutorialPanel/S.visible = true
|
|
|
|
if not d:
|
|
|
|
if Input.is_action_just_pressed("player_right"):
|
|
|
|
d = true
|
|
|
|
$TutorialPanel/D.visible = true
|
|
|
|
if w and a and s and d:
|
|
|
|
if not ran_timer:
|
|
|
|
await get_tree().create_timer(0.5).timeout
|
|
|
|
ran_timer = true
|
|
|
|
else:
|
|
|
|
tutorial_2()
|
|
|
|
|
|
|
|
var up = false
|
|
|
|
var left = false
|
|
|
|
var down = false
|
|
|
|
var right = false
|
2023-03-19 15:06:11 -06:00
|
|
|
var prev_cam_rot
|
2023-03-19 01:35:35 -06:00
|
|
|
var ran_timer2 = false
|
|
|
|
var ran_timer3 = false
|
|
|
|
var stage2 = false
|
|
|
|
|
|
|
|
func tutorial_2():
|
|
|
|
if not stage2:
|
|
|
|
stage2 = true
|
|
|
|
$TutorialPanel/W.visible = false
|
|
|
|
$TutorialPanel/A.visible = false
|
|
|
|
$TutorialPanel/S.visible = false
|
|
|
|
$TutorialPanel/D.visible = false
|
|
|
|
$TutorialPanel/Wasd.visible = false
|
|
|
|
$TutorialPanel/welcome.visible = false
|
|
|
|
$TutorialPanel/move.visible = false
|
|
|
|
|
|
|
|
$TutorialPanel/camera.visible = true
|
|
|
|
$TutorialPanel/Mouse.visible = true
|
|
|
|
$TutorialPanel/Arrow_up.visible = true
|
|
|
|
$TutorialPanel/Arrow_left.visible = true
|
|
|
|
$TutorialPanel/Arrow_down.visible = true
|
|
|
|
$TutorialPanel/Arrow_right.visible = true
|
2023-03-19 13:56:40 -06:00
|
|
|
play_audio(load("res://voice/tutorial/tutorial_2.mp3"))
|
2023-03-19 15:06:11 -06:00
|
|
|
prev_cam_rot = get_node(str(Global.selfTeddy) + '/CollisionShape3D/Neck/Camera3D').global_rotation
|
2023-03-19 01:35:35 -06:00
|
|
|
if not ran_timer2:
|
|
|
|
await get_tree().create_timer(0.5).timeout
|
|
|
|
ran_timer2 = true
|
|
|
|
else:
|
2023-03-19 13:11:15 -06:00
|
|
|
var cam_rot = get_node(str(Global.selfTeddy) + '/CollisionShape3D/Neck/Camera3D').global_rotation
|
2023-03-19 01:35:35 -06:00
|
|
|
if not up:
|
2023-03-19 13:11:15 -06:00
|
|
|
if cam_rot.x > prev_cam_rot.x:
|
2023-03-19 01:35:35 -06:00
|
|
|
up = true
|
|
|
|
$TutorialPanel/ArrowFilled_up.visible = true
|
|
|
|
if not down:
|
2023-03-19 13:11:15 -06:00
|
|
|
if cam_rot.x < prev_cam_rot.x:
|
2023-03-19 01:35:35 -06:00
|
|
|
down = true
|
|
|
|
$TutorialPanel/ArrowFilled_down.visible = true
|
|
|
|
if not left:
|
2023-03-19 13:11:15 -06:00
|
|
|
if cam_rot.y > prev_cam_rot.y:
|
2023-03-19 01:35:35 -06:00
|
|
|
left = true
|
|
|
|
$TutorialPanel/ArrowFilled_left.visible = true
|
|
|
|
if not right:
|
2023-03-19 13:11:15 -06:00
|
|
|
if cam_rot.y < prev_cam_rot.y:
|
2023-03-19 01:35:35 -06:00
|
|
|
right = true
|
|
|
|
$TutorialPanel/ArrowFilled_right.visible = true
|
2023-03-19 13:11:15 -06:00
|
|
|
prev_cam_rot = cam_rot
|
2023-03-19 01:35:35 -06:00
|
|
|
if up and left and right and down:
|
|
|
|
if not ran_timer3:
|
|
|
|
await get_tree().create_timer(0.5).timeout
|
|
|
|
ran_timer3 = true
|
|
|
|
else:
|
|
|
|
tutorial_3()
|
|
|
|
|
|
|
|
var stage3_continue = false
|
|
|
|
var stage3 = false
|
|
|
|
|
|
|
|
func tutorial_3():
|
|
|
|
if not stage3:
|
|
|
|
stage3 = true
|
|
|
|
$TutorialPanel/camera.visible = false
|
|
|
|
$TutorialPanel/Mouse.visible = false
|
|
|
|
$TutorialPanel/Arrow_up.visible = false
|
|
|
|
$TutorialPanel/Arrow_left.visible = false
|
|
|
|
$TutorialPanel/Arrow_down.visible = false
|
|
|
|
$TutorialPanel/Arrow_right.visible = false
|
|
|
|
$TutorialPanel/ArrowFilled_up.visible = false
|
|
|
|
$TutorialPanel/ArrowFilled_left.visible = false
|
|
|
|
$TutorialPanel/ArrowFilled_down.visible = false
|
|
|
|
$TutorialPanel/ArrowFilled_right.visible = false
|
|
|
|
|
|
|
|
$TutorialPanel/start.visible = true
|
|
|
|
$TutorialPanel/enter.visible = true
|
|
|
|
$TutorialPanel/EnterKey.visible = true
|
|
|
|
Global.HUDStartLabelText = "PRESS ENTER/RETURN TO START THE ROUND"
|
2023-03-19 13:56:40 -06:00
|
|
|
play_audio(load("res://voice/tutorial/tutorial_3.mp3"))
|
2023-05-02 12:31:10 -06:00
|
|
|
if not stage3_continue:
|
|
|
|
if Input.is_action_just_pressed("start_game"):
|
|
|
|
stage3_continue = true
|
|
|
|
$connectedPlayers.size.y += 26
|
|
|
|
$connectedPlayers/player2Label.text = "AI"
|
2023-03-19 01:35:35 -06:00
|
|
|
if stage3_continue:
|
|
|
|
tutorial_4()
|
|
|
|
|
|
|
|
var stage4_continue = false
|
|
|
|
var stage4 = false
|
|
|
|
|
|
|
|
func tutorial_4():
|
|
|
|
if not stage4:
|
|
|
|
stage4 = true
|
|
|
|
$TutorialPanel/start.visible = false
|
|
|
|
$TutorialPanel/enter.visible = false
|
|
|
|
$TutorialPanel/EnterKey.visible = false
|
|
|
|
|
|
|
|
$TutorialPanel/shoot.visible = true
|
|
|
|
$TutorialPanel/Leftmouse.visible = true
|
2023-03-19 13:56:40 -06:00
|
|
|
play_audio(load("res://voice/tutorial/tutorial_4.mp3"))
|
2023-03-19 01:35:35 -06:00
|
|
|
if Input.is_action_just_pressed("shoot"):
|
|
|
|
stage4_continue = true
|
|
|
|
if stage4_continue:
|
|
|
|
tutorial_5()
|
|
|
|
|
|
|
|
var stage5 = false
|
|
|
|
|
|
|
|
func tutorial_5():
|
|
|
|
if not stage5:
|
|
|
|
stage5 = true
|
|
|
|
$TutorialPanel/shoot.visible = false
|
|
|
|
$TutorialPanel/Leftmouse.visible = false
|
|
|
|
|
|
|
|
$TutorialPanel/learning.visible = true
|
|
|
|
$TutorialPanel/aim.visible = true
|
|
|
|
$TutorialPanel/timer.visible = true
|
|
|
|
$TutorialPanel/zero.visible = true
|
|
|
|
$TutorialPanel/done.visible = true
|
2023-03-19 13:56:40 -06:00
|
|
|
play_audio(load("res://voice/tutorial/tutorial_5.mp3"))
|
2023-05-28 23:37:11 -06:00
|
|
|
await get_tree().create_timer(17).timeout
|
2023-03-19 01:35:35 -06:00
|
|
|
$TutorialPanel.visible = false
|
|
|
|
Global.tutorialComplete = true
|
2023-05-27 16:49:09 -06:00
|
|
|
tutorial_6()
|
|
|
|
|
|
|
|
var stage6 = false
|
|
|
|
var stage6_continue = false
|
|
|
|
|
|
|
|
func tutorial_6():
|
|
|
|
if not stage6 and roundTimer <= 1.0:
|
|
|
|
print("stage6 fr")
|
|
|
|
stage6 = true
|
|
|
|
await get_tree().create_timer(3).timeout
|
|
|
|
play_audio(load("res://voice/tutorial/tutorial_6.mp3"))
|
|
|
|
Global.tutorialTimerCompleted = true
|
|
|
|
if Input.is_action_just_pressed("start_game"):
|
|
|
|
stage6_continue = true
|
|
|
|
if stage6_continue:
|
|
|
|
stage6_continue = false
|
|
|
|
Global.tutorialTimerCompleted = false
|
2023-03-19 13:56:40 -06:00
|
|
|
|
|
|
|
func play_audio(audio):
|
|
|
|
audio_stream_player.set_stream(audio)
|
|
|
|
add_child(audio_stream_player)
|
|
|
|
audio_stream_player.play()
|