multiple character creations

This commit is contained in:
Leon Palluch 2020-02-01 22:35:36 +01:00
parent 055fe16a46
commit 9f5593b8d7

View File

@ -7,8 +7,13 @@ const _win_screen_path = "res://UI/WinScreen.tscn"
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 _body_count = 0
var _body_positions = [Vector3(-30, 3, 0), Vector3(30, 3, 0), Vector3(0, 3, -30), Vector3(0, 3, 30)]
func _ready(): func _ready():
InGameState.player_count = 4
_prep_scene("body_build") _prep_scene("body_build")
_prep_scene("fight_scene") _prep_scene("fight_scene")
_prep_scene("win_screen") _prep_scene("win_screen")
@ -52,13 +57,22 @@ func _switch_to_win(player_id):
func _switch_to_fighting(torso): func _switch_to_fighting(torso):
_body_build_scene.remove_child(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) 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(): func _switch_to_body_build():
_switch_scene(_body_build_scene, "body_build") _switch_scene(_body_build_scene, "body_build")