100 lines
2.8 KiB
GDScript
100 lines
2.8 KiB
GDScript
extends Control
|
|
|
|
var mainMenuScene = "res://scenes/mainmenu.tscn"
|
|
var musicName = "Fall From Grace"
|
|
var musicAuthor = "Darren Curtis"
|
|
|
|
func _ready():
|
|
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:
|
|
Global.connectedPlayers = []
|
|
Networking.connected_peers = []
|
|
$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:
|
|
get_tree().change_scene_to_file("res://scenes/tutorial.tscn")
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
elif Global.playingGame == true:
|
|
self.queue_free()
|
|
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()
|