project_teddy/scripts/mainmenu.gd

44 lines
1.1 KiB
GDScript

extends Control
var mainMenuScene = "res://scenes/mainmenu.tscn"
func _ready():
if Global.playingGame == true:
$Button.text = "RESUME"
$Button4.text = "MAIN MENU"
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():
if Global.playingGame == false:
get_tree().change_scene_to_file("res://scenes/multiplayer.tscn")
if Global.playingGame == true:
Global.goScene = mainMenuScene
var scene_trs =load("res://scenes/sceneChangerConfirm.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)