I'm not sure what's going in, in this case. I added a print statement to _on_GodotArea2D_area_centered() to see if the collision was being made, and it was. Each time I enter the area with Godot, it says "a contact was made." But for the life of me I can't understand why the counter isn't being updated.
Oddly, using a print statement also reports the same amount of gems, as well.
A bit of guidance here would be appreciated.
var counter := 0
onready var godot_area: Area2D = $Godot/Area2D
onready var ui_counter: Label = $UI/Counter
func _ready() -> void:
func _on_GodotArea2D_area_entered(_area: Area2D) -> void:
counter += 1
print("There are "+ str(counter) + " gems.")
ui_counter.text = "Gems: " + str(counter)
Yes, so it's true that you did connect godot_area to the _on_GodotArea2D_area_entered() function in the sense that you specify them in the connect() function.
You can always check the *Tests.gd files as a guide if you get really stuck, it might give you an idea of what to fix. Although I would say do that as a last resort because the scrips are generally advanced and sometimes might bring in more confusion if you don't know what to look for.
In your case, like I mentioned, you indeed connect the right nodes, but we can connect them in two ways:
You use connect("area_entered", godot_area, "_on_GodotArea2D_area_entered") which can be thought of like item 1. in the list: connect self node's "area_entered" signal to function "_on_GodotArea2D_area_entered" in godot_area.
You're trying to connect the "area_entered" signal from self, which is a YSort node. And we know for sure that YSort nodes don't have an "area_entered" signals because that's an Area2D specific signal.
So think about the multiple ways we can connect nodes signals and hopefully you can figure it out!
Let us know how it goes.