All Questions

Community

L
Livewire

Practice worded oddly

This part:
"you’ll need to open the Gem.tscn scene and change the script and the Gem node. The Gem node is an Area2D."

It heavily implies we need to change the actual nodes type FROM an area2D, rather than modifying it's collision layers. Took my a while to figure out what you actually wanted us to do etc.

Something like:
"you’ll need to open the Gem.tscn scene and change the script and the Gem node's properties."

Might just make things a bit clearer.

As a secondary thing, assuming my code is correct, I am not sure we have been told how to access a root node when creating a variable up to this point? (I could be wrong). Whilst I figured out it was probably self, others might get confused as the lesson code has a Node2D as the root with the Area2D under it to target.



  • L
    Livewire replied

    Actually it only just occured to me we don't even need to make a var right? I can just call self.connect...dunno why I didn't think of that sooner haha. Think I just got used to having variables in all the code so far and we did it in the example lol.

  • Nathan Lovato replied

    I see the issue with the practice. We called connect but only on different nodes until now. I'm taking a note to update the practice in an upcoming release.

  • Nathan Lovato replied

    Oh, and you don't need the leading self in GDScript, like you access member variables by just typing their names, you can connect a signal of this node by calling the connect() function directly.

    connect("body_entered", self, "_on_body_entered")