added player count to ui
This commit is contained in:
1 parent
d3eb64493c
commit
d2f639dc14
3 files changed
+28
-2
No files matched your search
@@ -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"]
|
||||
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user