gordle/src/menu.gd

35 lines
769 B
GDScript3
Raw Normal View History

2022-02-24 05:23:47 +00:00
extends Control
2022-02-24 04:31:14 +00:00
2024-02-18 08:02:01 +00:00
@onready var quit_button: Button = %QuitButton
@onready var credits: ColorRect = %Credits
2022-02-24 04:31:14 +00:00
func _ready() -> void:
2024-02-18 08:02:01 +00:00
if OS.has_feature("web"):
quit_button.hide()
2022-02-24 04:31:14 +00:00
func _on_DailyButton_pressed() -> void:
2024-03-08 02:59:31 +00:00
Global.game_mode = Global.GameMode.DAILY
var error := get_tree().change_scene_to_file("res://src/main.tscn")
2022-02-24 04:31:14 +00:00
assert(not error)
func _on_RandomButton_pressed() -> void:
2024-03-08 02:59:31 +00:00
Global.game_mode = Global.GameMode.RANDOM
var error := get_tree().change_scene_to_file("res://src/main.tscn")
2022-02-24 04:31:14 +00:00
assert(not error)
func _on_CreditsButton_pressed() -> void:
2024-02-18 08:02:01 +00:00
credits.show()
2022-02-24 04:31:14 +00:00
func _on_QuitButton_pressed() -> void:
get_tree().get_root().propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
2022-02-24 05:23:47 +00:00
func _on_CreditsBackButton_pressed() -> void:
2024-02-18 08:02:01 +00:00
credits.hide()