From 9f5593b8d7209cc79e7b961c6446487581f168cb Mon Sep 17 00:00:00 2001 From: Leon Palluch Date: Sat, 1 Feb 2020 22:35:36 +0100 Subject: [PATCH] multiple character creations --- Controllers/GameStateController.gd | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Controllers/GameStateController.gd b/Controllers/GameStateController.gd index 9878b15..c4e8889 100644 --- a/Controllers/GameStateController.gd +++ b/Controllers/GameStateController.gd @@ -7,8 +7,13 @@ const _win_screen_path = "res://UI/WinScreen.tscn" var _body_build_scene var _fighting_scene var _win_screen_scene +var _bodies : Array +var _body_count = 0 +var _body_positions = [Vector3(-30, 3, 0), Vector3(30, 3, 0), Vector3(0, 3, -30), Vector3(0, 3, 30)] func _ready(): + InGameState.player_count = 4 + _prep_scene("body_build") _prep_scene("fight_scene") _prep_scene("win_screen") @@ -52,13 +57,22 @@ func _switch_to_win(player_id): func _switch_to_fighting(torso): _body_build_scene.remove_child(torso) - torso.translation += Vector3(0, 3, 0) + torso.translation += _body_positions[_body_count] torso.rotation = Vector3(0, 0, 0) - _switch_scene(_fighting_scene, "fight_scene") - _fighting_scene.add_child(torso) + _body_count += 1 + if _body_count < InGameState.player_count: + _bodies.append(torso) + _switch_scene(_body_build_scene, "body_build") + else: + _switch_scene(_fighting_scene, "fight_scene") + + for body in _bodies: + _fighting_scene.add_child(body) + _fighting_scene.add_child(torso) func _switch_to_body_build(): _switch_scene(_body_build_scene, "body_build") +