From 508b6d1fcdb101f1786261761293a235dfce6e23 Mon Sep 17 00:00:00 2001 From: Leon Palluch Date: Sun, 2 Feb 2020 11:15:30 +0100 Subject: [PATCH] starting with main menu --- Controllers/GameStateController.gd | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Controllers/GameStateController.gd b/Controllers/GameStateController.gd index e0b7687..4b193df 100644 --- a/Controllers/GameStateController.gd +++ b/Controllers/GameStateController.gd @@ -1,12 +1,15 @@ extends Node +const _main_menu_path = "res://UI/MainMenu.tscn" const _body_build_path = "res://BodyConfig/bodyBuilderMenu.tscn" const _fighting_path = "res://Ingame/Testing.tscn" const _win_screen_path = "res://UI/WinScreen.tscn" +var _main_menu_scene var _body_build_scene var _fighting_scene var _win_screen_scene + var _bodies : Array var _body_count = 0 var _body_positions = [Vector3(0, 15, -30), Vector3(0, 15, 30), Vector3(-30, 15, 0), Vector3(30, 15, 0)] @@ -14,15 +17,17 @@ var _body_positions = [Vector3(0, 15, -30), Vector3(0, 15, 30), Vector3(-30, 15, func _ready(): InGameState.player_count = 2 - _prep_scene("body_build") - _prep_scene("fight_scene") - _prep_scene("win_screen") + _prep_scene("main_menu") - _switch_scene(_body_build_scene, "body_build") + _switch_scene(_main_menu_scene, "main_menu") func _prep_scene(scene_name) -> Node: - if scene_name == "body_build": + if scene_name == "main_menu": + _main_menu_scene = preload(_main_menu_path).instance() + _main_menu_scene.connect("body_build", self, "_switch_to_body_build") + return _main_menu_scene + elif scene_name == "body_build": _body_build_scene = preload(_body_build_path).instance() _body_build_scene.connect("start_fight", self, "_switch_to_fighting") return _body_build_scene @@ -86,3 +91,4 @@ func _switch_to_fighting(torso): func _switch_to_body_build(): _switch_scene(_body_build_scene, "body_build") + _body_build_scene.change_count_ui()