project_teddy/scripts/mainmenu.gd
2023-02-24 23:49:49 -07:00

71 lines
1.8 KiB
GDScript

extends Control
var mainMenuScene = "res://scenes/mainmenu.tscn"
func _ready():
if Global.playingGame == true:
$Button.text = "RESUME"
$Background.visible = false
$playButton.visible = false
func _process(delta):
pass
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.menuOpen = false
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():
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