project_teddy/scripts/mainmenu.gd

81 lines
2.2 KiB
GDScript

extends Control
var mainMenuScene = "res://scenes/mainmenu.tscn"
func _ready():
if Global.playingGame == true:
$Button.text = "RESUME"
$Button3.text = "MAIN MENU"
$Background.visible = false
$playButton.visible = false
$OurTimeIsNowSolo.visible = false
$Button.disabled = false
$AudioStreamPlayer.playing = 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:
get_tree().change_scene_to_file("res://scenes/mainmenu.tscn")
Global.playingGame = false
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