46 lines
1.2 KiB
GDScript
46 lines
1.2 KiB
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)
|
|
start_new_game()
|
|
return
|
|
|
|
# On start of the game, the main menu is shown
|
|
UI.connect("on_new_game_started", start_new_game)
|
|
UI.connect("on_game_continued", continue_game)
|
|
UI.show_main_menu()
|
|
|
|
|
|
# this event comes from the MainMenu Node in the UI
|
|
func start_new_game() -> 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)
|
|
|
|
# Give the player a monster
|
|
var monster = MonsterData.new()
|
|
monster.set_data("debuggy")
|
|
SaveManager.current_save.party.push_back(monster)
|
|
|
|
# Update the UI once
|
|
UI.update()
|
|
|
|
# event comes from the MainMenu Node in the UI
|
|
func continue_game() -> void:
|
|
SaveManager.load_game()
|
|
UI.show_ingame_controls()
|
|
UI.update()
|