Hi, I have a spawner that sends out items that are procedurally generated therefore not in the same root scene as the player or my score label. Essentially I'm trying to get my score to go up when the player runs into them.
code on my item
signal eaten
func _on_collect4_body_entered(body):
emit_signal("eaten")
queue_free()
pass
code on my world node
onready var collect4 = get_node("../collect4")
func _ready():
collect4.connect("eaten", $scoreLabel, "_on_collect4_body_entered")
pass
code on my label
extends Label
var score = 0
onready var collect4 = get_node("../collect4")
func _ready():
collect4.connect("eaten", $self, "_on_collect4_body_entered")
func _on_collect4_body_entered():
score += 1
text = "Score: %s" % score
print(score)
I'm not sure how to properly call the node from a different scene?