Fix all HUDs of players being shown, rather than just the local player
parent
2f3fcc6337
commit
23a4bf0bad
|
@ -8,17 +8,3 @@ func updateCrosshair(visible: bool, hit: bool):
|
||||||
$Crosshair.visible = visible
|
$Crosshair.visible = visible
|
||||||
if hit:
|
if hit:
|
||||||
$Crosshair/HitConfirmation.activate(0.2)
|
$Crosshair/HitConfirmation.activate(0.2)
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta):
|
|
||||||
# pass
|
|
||||||
|
|
5
Game.gd
5
Game.gd
|
@ -205,10 +205,7 @@ sync func check_players(player_names):
|
||||||
player.translation += Vector3(0.0, 3.0, 0.0)
|
player.translation += Vector3(0.0, 3.0, 0.0)
|
||||||
|
|
||||||
if player_name == str(get_tree().get_network_unique_id()):
|
if player_name == str(get_tree().get_network_unique_id()):
|
||||||
player.camera.current = true
|
player.set_local_player()
|
||||||
player.set_network_master(get_tree().get_network_unique_id())
|
|
||||||
|
|
||||||
local_player = player
|
|
||||||
|
|
||||||
func add_player(id, check=true):
|
func add_player(id, check=true):
|
||||||
var player = player_scene.instance()
|
var player = player_scene.instance()
|
||||||
|
|
|
@ -88,9 +88,9 @@ text = "Quit"
|
||||||
[node name="ConnectMenu" type="VBoxContainer" parent="MenuContainer"]
|
[node name="ConnectMenu" type="VBoxContainer" parent="MenuContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
margin_left = 312.0
|
margin_left = 312.0
|
||||||
margin_top = 216.0
|
margin_top = 212.0
|
||||||
margin_right = 712.0
|
margin_right = 712.0
|
||||||
margin_bottom = 384.0
|
margin_bottom = 388.0
|
||||||
rect_min_size = Vector2( 400, 0 )
|
rect_min_size = Vector2( 400, 0 )
|
||||||
|
|
||||||
[node name="Back" type="Button" parent="MenuContainer/ConnectMenu"]
|
[node name="Back" type="Button" parent="MenuContainer/ConnectMenu"]
|
||||||
|
|
|
@ -325,6 +325,13 @@ func _input(event):
|
||||||
if event.is_action_pressed("WeaponPrimary"):
|
if event.is_action_pressed("WeaponPrimary"):
|
||||||
shoot()
|
shoot()
|
||||||
|
|
||||||
|
func set_local_player():
|
||||||
|
set_network_master(get_tree().get_network_unique_id())
|
||||||
|
game.local_player = self
|
||||||
|
camera.current = true
|
||||||
|
|
||||||
|
$HUD.show()
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
set_health(150)
|
set_health(150)
|
||||||
|
|
|
@ -70,3 +70,4 @@ SoundClip = "res://Assets/SFX/Player-Pain-01.wav"
|
||||||
MinDelay = 0.2
|
MinDelay = 0.2
|
||||||
|
|
||||||
[node name="HUD" parent="." instance=ExtResource( 3 )]
|
[node name="HUD" parent="." instance=ExtResource( 3 )]
|
||||||
|
visible = false
|
||||||
|
|
Reference in New Issue