pir-serious-game-ethics/scenes/MainMenu.gd

44 lines
1.1 KiB
GDScript3
Raw Normal View History

2021-04-10 18:29:03 +02:00
extends Control
2021-04-23 15:59:32 +02:00
var MAIN_MENU_MUSIC = "res://music/menu_principal.ogg"
2021-04-25 00:44:17 +02:00
onready var exit_button = $MarginContainer/VBoxContainer/HBoxContainer/CenterContainer/Panel/MarginContainer/CenterContainer/VBoxContainer/MarginContainer2/ExitButton
2021-04-26 17:41:28 +02:00
onready var continue_button = $MarginContainer/VBoxContainer/HBoxContainer/CenterContainer/Panel/MarginContainer/CenterContainer/VBoxContainer/ContinueButton
var save_available := false
2021-04-25 00:09:42 +02:00
2021-04-23 15:59:32 +02:00
func _ready():
BackgroundMusic.crossfade_to(MAIN_MENU_MUSIC, -10, 1)
2021-04-25 00:09:42 +02:00
if OS.get_name() == "HTML5":
exit_button.hide()
2021-04-26 17:41:28 +02:00
save_available = not Dialogic.get_current_timeline().empty()
if not save_available:
continue_button.hide()
2021-04-23 15:59:32 +02:00
2021-04-10 18:29:03 +02:00
func load_main_game():
2021-04-25 00:07:38 +02:00
Transit.change_scene("res://scenes/Main.tscn", 0.5)
2021-04-10 18:29:03 +02:00
2021-04-20 11:36:39 +02:00
func load_credits():
2021-04-25 00:07:38 +02:00
Transit.change_scene("res://scenes/Credits.tscn", 0.2)
2021-04-20 11:36:39 +02:00
2021-04-10 18:29:03 +02:00
func _on_NewGameButton_pressed():
2021-04-12 10:59:06 +02:00
Dialogic.reset_saves()
2021-04-10 18:29:03 +02:00
load_main_game()
2021-04-25 00:07:38 +02:00
2021-04-10 18:29:03 +02:00
func _on_ContinueButton_pressed():
load_main_game()
func _on_ExitButton_pressed():
2021-04-25 00:30:26 +02:00
Transit.change_scene("res://scenes/ExitScene.tscn", 0.2)
2021-04-20 11:36:39 +02:00
func _on_CreditsButton_pressed():
load_credits()