Hi, I´m making a pong game and I have a problem with the HUD, the HUD it´s made from a canvas layer with 2 Labels and the problem is that points get subtract or attribute to the wrong player on occasions (like 1 or 2 times and a playthrough) then works fine, the points are attributed using signals and area2D, this is the code of the HUD:
extends CanvasLayer
var score_1 = 0
var score_2 = 0
func _ready():
pass
func update_score():
$Score_1.text = str(score_1)
$Score_2.text = str(score_2)
func _on_Meta_1_body_entered(_body):
update_score()
score_1 += 1
func _on_Meta_2_body_entered(_body):
update_score()
score_2 += 1