diff --git a/BodyConfig/bodyBuilderMenu.tscn b/BodyConfig/bodyBuilderMenu.tscn index ad2d965..085ecae 100644 --- a/BodyConfig/bodyBuilderMenu.tscn +++ b/BodyConfig/bodyBuilderMenu.tscn @@ -10,6 +10,7 @@ torsoPath = NodePath("Torso") cameraPath = NodePath("GUI/HBoxC/ViewportContainer/Viewport/Camera") rayCastPath = NodePath("GUI/HBoxC/ViewportContainer/Viewport/MouseLook") viewPortPath = NodePath("GUI/HBoxC/ViewportContainer/Viewport") +playerNumPath = NodePath("PlayerCountLabel") [node name="GUI" type="MarginContainer" parent="."] anchor_right = 1.0 @@ -65,5 +66,17 @@ enabled = true collide_with_areas = true collide_with_bodies = false +[node name="PlayerCountLabel" type="Label" parent="."] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -30.0 +margin_right = 1.90735e-06 +margin_bottom = 600.0 +rect_min_size = Vector2( 30, 30 ) +text = "1/4" +__meta__ = { +"_edit_use_anchors_": false +} + [node name="Torso" parent="." instance=ExtResource( 1 )] [connection signal="pressed" from="GUI/HBoxC/VBoxC/Start" to="." method="_on_Start_pressed"] diff --git a/BodyConfig/bodyBuildingScript.gd b/BodyConfig/bodyBuildingScript.gd index f62638c..f264ced 100644 --- a/BodyConfig/bodyBuildingScript.gd +++ b/BodyConfig/bodyBuildingScript.gd @@ -4,6 +4,7 @@ export(NodePath) var torsoPath export(NodePath) var cameraPath export(NodePath) var rayCastPath export(NodePath) var viewPortPath +export(NodePath) var playerNumPath const ROT_MOD = 500 const ROT_DECLINE = 0.1 @@ -14,12 +15,14 @@ var _camera : Camera var _rayCast : RayCast var _torso : RigidBody var _viewport : Viewport +var _playerNum : Label var _velx = 0 var _vely = 0 var _attachment_point : Spatial var _default_grav +var done_player_count = 0 signal start_fight() @@ -31,6 +34,14 @@ func _ready(): _camera = get_node(cameraPath) as Camera _rayCast = get_node(rayCastPath) as RayCast _viewport = get_node(viewPortPath) as Viewport + _playerNum = get_node(playerNumPath) as Label + + +func change_count_ui(): + if done_player_count == null: + print("test") + done_player_count = 0 + _playerNum.text = str(done_player_count + 1) + "/" + str(InGameState.player_count) func _process(delta): diff --git a/Controllers/GameStateController.gd b/Controllers/GameStateController.gd index c4e8889..acaac2b 100644 --- a/Controllers/GameStateController.gd +++ b/Controllers/GameStateController.gd @@ -36,6 +36,7 @@ func _prep_scene(scene_name) -> Node: return _win_screen_scene return null + func _switch_scene(scene, scene_name): #delete children for child in get_children(): @@ -64,6 +65,9 @@ func _switch_to_fighting(torso): if _body_count < InGameState.player_count: _bodies.append(torso) _switch_scene(_body_build_scene, "body_build") + + _body_build_scene.done_player_count = _body_count + _body_build_scene.change_count_ui() else: _switch_scene(_fighting_scene, "fight_scene") @@ -74,5 +78,3 @@ func _switch_to_fighting(torso): func _switch_to_body_build(): _switch_scene(_body_build_scene, "body_build") - -