#My Scripts can't find the nodes I'm refering to, even though it works on the tutorial.

6 messages · Page 1 of 1 (latest)

remote mist
#

The reason var anim = $Pet doesn't work is because your script, Main.gd, is on the Pet node itself. So Pet is actually self in this case. So, you can skip the anim part and just do:

sprite_frames.get_frame_texture(animation, frame)

#

But actually, I would imagine that what the tutorial maker intended was for you to put Main.gd on the root node of the scene (the one called Node2D) instead of on the Pet node.

#

So here's what you should do:

  1. remove the script from Pet by clicking the script button with a red X above the scene tree
  2. Drag Main.gd onto the root node
  3. Change like 53 to var texture = anim.sprite_frames.get_frame_texture(anim.animation, anim.frame)
glass yoke
remote mist
#

Ok, that's probably from another part of your script that you didn't show in the first picture, can you show the whole thing?

glass yoke