This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
Jessist/Scripts/MainScreen.gd

58 lines
2.1 KiB
GDScript3
Raw Permalink Normal View History

2022-06-18 13:05:48 +02:00
######################
### Jessist Script ###
######################
# This script is part of Jessist
# Jessist is licensed under GNU GPLv3
#
# This script manages the whole MainScreen scene
extends Node
export var skipMenu = false
func _ready():
gameController.logCall("MainScreen","_ready",null)
get_tree().set_auto_accept_quit(true)
if gameController.debuggingMode:
get_node("Background/warn-dev").visible = true
else:
skipMenu = false
get_node("Background/warn-dev").visible = false
get_node("Background/CreditsUI").visible = false
get_node("Background/MainUI").visible = true
if skipMenu:
gameController.logInfo("MainScreen","_ready","Skipping menu (skipMenu is true)")
startButtonPressed()
if not gameController.isMusicPlaying():
gameController.loadMusic("Rocket")
gameController.playMusic(null)
gameController.changeVolume("volumeDefault")
func startButtonPressed():
gameController.logCall("MainScreen","startButtonPressed",null)
gameController.logInfo("MainScreen","startButtonPressed","Starting")
gameController.logInfo("MainScreen","startButtonPressed","Loading level0 scene")
#gameController.switchScene("res://Scenes/Level0.tscn")
gameController.switchScene("res://Scenes/BossFight.tscn")
func creditsButtonPressed():
gameController.logCall("MainScreen","creditsButtonPressed",null)
gameController.logInfo("MainScreen","creditsButtonPressed","Credits")
get_node("Background/CreditsUI").visible = true
get_node("Background/MainUI").visible = false
func creditsCloseButtonPressed():
gameController.logCall("MainScreen","creditsCloseButtonPressed",null)
gameController.logInfo("MainScreen","creditsCloseButtonPressed","Credits Close")
get_node("Background/CreditsUI").visible = false
get_node("Background/MainUI").visible = true
func quitButtonPressed():
gameController.logCall("MainScreen","quitButtonPressed",null)
gameController.logInfo("MainScreen","quitButtonPressed","Quit")
gameController._transition_start()
yield(get_tree().create_timer(1), "timeout")
get_tree().notification(NOTIFICATION_WM_QUIT_REQUEST)
get_tree().quit()
#get_tree().change_scene("res://SplashScreen.tscn")