extends Control var mainMenuScene = "res://scenes/mainmenu.tscn" var musicName = "Fall From Grace" var musicAuthor = "Darren Curtis" @export var audio_bus_name := "Master" @onready var _bus := AudioServer.get_bus_index(audio_bus_name) func _ready(): AudioServer.set_bus_volume_db(_bus, linear_to_db(Global.volumeModifer)) if Global.playingGame == true: $Button.text = "RESUME" $Button3.text = "MAIN MENU" $playButton.visible = false $OurTimeIsNowSolo.visible = false $Button.disabled = false $AudioStreamPlayer.playing = false if Global.playingGame == false: if not Global.tutorialCompleted: load_tutorial() Global.mapName = "Tutorial" Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) Global.reset_variables_hard() $musicPanel.visible = true $musicPanel/playingLabel.text = musicName $musicPanel/authorLabel.text = musicAuthor await get_tree().create_timer(3).timeout $musicPanel.visible = false func _process(delta): if Global.playingGame == false: if $AudioStreamPlayer.playing == false: $AudioStreamPlayer.playing = true func _on_button_pressed(): if Global.playingGame == false: load_tutorial() Global.mapName = "Tutorial" Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) elif Global.playingGame == true: self.visible = false Global.miniMenuResume = true Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) func _on_button_2_pressed(): var scene_trs =load("res://scenes/settings.tscn") var scene=scene_trs.instantiate() add_child(scene) func _on_button_3_pressed(): if Global.playingGame == true: Global.goScene = "res://scenes/mainmenu-background.tscn" var scene_trs =load("res://scenes/sceneChangerConfirm.tscn") var scene=scene_trs.instantiate() add_child(scene) elif Global.playingGame == false: get_tree().quit() func _on_button_4_pressed(): var scene_trs =load("res://scenes/multiplayer.tscn") var scene=scene_trs.instantiate() add_child(scene) func _on_button_5_pressed(): var scene_trs =load("res://scenes/credits.tscn") var scene=scene_trs.instantiate() add_child(scene) func _on_play_button_mouse_entered(): $playButton/PlayUnselected.visible = false $playButton/PlaySelected.visible = true func _on_play_button_mouse_exited(): $playButton/PlayUnselected.visible = true $playButton/PlaySelected.visible = false func _on_settings_button_mouse_entered(): $settingsButton/SettingsUnselected.visible = false $settingsButton/SettingsSelected.visible = true func _on_settings_button_mouse_exited(): $settingsButton/SettingsUnselected.visible = true $settingsButton/SettingsSelected.visible = false func _on_credits_button_mouse_entered(): $creditsButton/CreditUnselected.visible = false $creditsButton/CreditSelected.visible = true func _on_credits_button_mouse_exited(): $creditsButton/CreditUnselected.visible = true $creditsButton/CreditSelected.visible = false func _on_light_button_pressed(): Global.menuLightSwitch = true var audiostream = AudioStreamPlayer.new() audiostream.set_stream(load("res://sounds/light-switch.mp3")) add_child(audiostream) audiostream.play() func _on_issues_button_pressed(): OS.shell_open("https://git.techwizz-emu.com/the_adventures_of_teddy/public_issues/issues") func load_tutorial(): Global.playerPleaseRespawn = true Networking.create_server(28000, 1) Networking.load_map("res://scenes/tutorial.tscn") Networking.add_player_node(1) Global.connectedPlayers += [Global.playerName] Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)