starting with main menu

This commit is contained in:
Leon Palluch 2020-02-02 11:15:30 +01:00
parent 62b688f83d
commit 508b6d1fcd

View File

@ -1,12 +1,15 @@
extends Node extends Node
const _main_menu_path = "res://UI/MainMenu.tscn"
const _body_build_path = "res://BodyConfig/bodyBuilderMenu.tscn" const _body_build_path = "res://BodyConfig/bodyBuilderMenu.tscn"
const _fighting_path = "res://Ingame/Testing.tscn" const _fighting_path = "res://Ingame/Testing.tscn"
const _win_screen_path = "res://UI/WinScreen.tscn" const _win_screen_path = "res://UI/WinScreen.tscn"
var _main_menu_scene
var _body_build_scene var _body_build_scene
var _fighting_scene var _fighting_scene
var _win_screen_scene var _win_screen_scene
var _bodies : Array var _bodies : Array
var _body_count = 0 var _body_count = 0
var _body_positions = [Vector3(0, 15, -30), Vector3(0, 15, 30), Vector3(-30, 15, 0), Vector3(30, 15, 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(): func _ready():
InGameState.player_count = 2 InGameState.player_count = 2
_prep_scene("body_build") _prep_scene("main_menu")
_prep_scene("fight_scene")
_prep_scene("win_screen")
_switch_scene(_body_build_scene, "body_build") _switch_scene(_main_menu_scene, "main_menu")
func _prep_scene(scene_name) -> Node: 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 = preload(_body_build_path).instance()
_body_build_scene.connect("start_fight", self, "_switch_to_fighting") _body_build_scene.connect("start_fight", self, "_switch_to_fighting")
return _body_build_scene return _body_build_scene
@ -86,3 +91,4 @@ func _switch_to_fighting(torso):
func _switch_to_body_build(): func _switch_to_body_build():
_switch_scene(_body_build_scene, "body_build") _switch_scene(_body_build_scene, "body_build")
_body_build_scene.change_count_ui()