project_teddy/scripts/mainmenu.gd

92 lines
2.5 KiB
GDScript3
Raw Normal View History

2023-01-24 13:33:37 -07:00
extends Control
var mainMenuScene = "res://scenes/mainmenu.tscn"
2023-03-11 18:50:43 -07:00
var musicName = "Fall From Grace"
var musicAuthor = "Darren Curtis"
2023-01-26 13:23:13 -07:00
2023-01-24 13:33:37 -07:00
func _ready():
2023-01-26 13:23:13 -07:00
if Global.playingGame == true:
$Button.text = "RESUME"
2023-03-05 20:15:46 -07:00
$Button3.text = "MAIN MENU"
2023-02-24 23:49:49 -07:00
$playButton.visible = false
2023-03-05 20:15:46 -07:00
$OurTimeIsNowSolo.visible = false
$Button.disabled = false
$AudioStreamPlayer.playing = false
2023-03-11 14:48:23 -07:00
if Global.playingGame == false:
Global.connectedPlayers = []
2023-03-11 18:50:43 -07:00
$musicPanel.visible = true
$musicPanel/playingLabel.text = musicName
$musicPanel/authorLabel.text = musicAuthor
await get_tree().create_timer(3).timeout
$musicPanel.visible = false
2023-01-24 13:33:37 -07:00
func _process(delta):
if Global.playingGame == false:
if $AudioStreamPlayer.playing == false:
$AudioStreamPlayer.playing = true
2023-01-24 13:33:37 -07:00
func _on_button_pressed():
2023-01-26 13:23:13 -07:00
if Global.playingGame == false:
get_tree().change_scene_to_file("res://scenes/tutorial.tscn")
2023-01-26 13:23:13 -07:00
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
elif Global.playingGame == true:
self.queue_free()
2023-03-02 12:52:49 -07:00
Global.miniMenuResume = true
2023-01-26 13:23:13 -07:00
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
2023-01-26 12:17:54 -07:00
func _on_button_2_pressed():
var scene_trs =load("res://scenes/settings.tscn")
2023-01-24 13:33:37 -07:00
var scene=scene_trs.instantiate()
add_child(scene)
2023-01-26 12:17:54 -07:00
func _on_button_3_pressed():
2023-03-05 20:15:46 -07:00
if Global.playingGame == true:
2023-03-11 16:03:03 -07:00
Global.goScene = "res://scenes/mainmenu-background.tscn"
var scene_trs =load("res://scenes/sceneChangerConfirm.tscn")
var scene=scene_trs.instantiate()
add_child(scene)
2023-03-05 20:15:46 -07:00
elif Global.playingGame == false:
get_tree().quit()
func _on_button_4_pressed():
2023-02-24 23:49:49 -07:00
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)
2023-02-24 23:49:49 -07:00
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