Added name label above player #4

This commit is contained in:
Paul Black 2023-02-25 15:21:18 -07:00
parent 2a729d85fa
commit 71b669eb44
4 changed files with 25 additions and 1 deletions

View file

@ -23,6 +23,7 @@ func _ready():
selfTeddy = self.get_path() selfTeddy = self.get_path()
teddyParent = get_node(selfTeddy).get_parent() teddyParent = get_node(selfTeddy).get_parent()
Global.teddyAuthorityID = teddyAuthority Global.teddyAuthorityID = teddyAuthority
Global.playerName = $nameLabel
func _unhandled_input(event): func _unhandled_input(event):
Global.selfTeddy = selfTeddy Global.selfTeddy = selfTeddy

View file

@ -26,3 +26,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.859224, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.104801, -0.858231) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.104801, -0.858231)
[node name="sound" type="AudioStreamPlayer3D" parent="."] [node name="sound" type="AudioStreamPlayer3D" parent="."]
[node name="nameLabel" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.60152, 0)
text = "Un-named Player"

View file

@ -131,7 +131,21 @@ offset_right = 620.0
offset_bottom = 187.0 offset_bottom = 187.0
text = "Host Game" text = "Host Game"
[node name="playerNameBox" type="LineEdit" parent="."]
offset_left = 392.0
offset_top = 527.0
offset_right = 559.0
offset_bottom = 570.0
[node name="playerLabel" type="Label" parent="."]
offset_left = 269.0
offset_top = 536.0
offset_right = 377.0
offset_bottom = 562.0
text = "Player Name: "
[connection signal="pressed" from="close" to="." method="_on_close_pressed"] [connection signal="pressed" from="close" to="." method="_on_close_pressed"]
[connection signal="pressed" from="playground" to="." method="_on_playground_pressed"] [connection signal="pressed" from="playground" to="." method="_on_playground_pressed"]
[connection signal="pressed" from="startButton" to="." method="_on_start_button_pressed"] [connection signal="pressed" from="startButton" to="." method="_on_start_button_pressed"]
[connection signal="pressed" from="joinButton" to="." method="_on_join_button_pressed"] [connection signal="pressed" from="joinButton" to="." method="_on_join_button_pressed"]
[connection signal="text_changed" from="playerNameBox" to="." method="_on_player_name_box_text_changed"]

View file

@ -3,7 +3,7 @@ extends Node
var SCENE var SCENE
func _ready(): func _ready():
pass $playerNameBox.text = Global.playerName
func _process(delta): func _process(delta):
@ -55,3 +55,8 @@ func _on_join_button_pressed():
var scene=scene_trs.instantiate() var scene=scene_trs.instantiate()
get_parent().add_child(scene) get_parent().add_child(scene)
self.queue_free() self.queue_free()
func _on_player_name_box_text_changed(new_text):
$playerNameBox.text = Global.playerName
SettingsFile.save_data(Global.mouseSensitivity, Global.playerName)