34 lines
955 B
GDScript
34 lines
955 B
GDScript
extends Node3D
|
|
# Game.gd - Main Entrypoint for the game
|
|
|
|
@export var skip_menu: bool = true
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
|
|
# Skip the menu for development
|
|
if skip_menu == true:
|
|
UI.show_ingame_controls(!skip_menu)
|
|
UI.show_main_menu(!skip_menu)
|
|
_on_ui_on_new_game_started()
|
|
return
|
|
|
|
# On start of the game, the main menu is shown
|
|
UI.show_main_menu()
|
|
|
|
# this event comes from the MainMenu Node in the UI
|
|
func _on_ui_on_new_game_started() -> void:
|
|
var world = preload("res://worlds/debug_level.tscn").instantiate()
|
|
UI.show_ingame_controls()
|
|
|
|
# Add the starting world
|
|
%CurrentLevel.add_child(world)
|
|
|
|
# Add the starting player to the starting world
|
|
var player = preload("res://entities/player/player.tscn").instantiate()
|
|
world.add_child(player)
|
|
|
|
# event comes from the MainMenu Node in the UI
|
|
func _on_ui_on_game_continued() -> void:
|
|
SaveGame.load()
|
|
UI.show_ingame_controls()
|