0 votes

For whatever reason, the $ isn't finding the sprites on the left. I checked the spelling & everything, it seems to be perfect. maybe i don't know how to use "connect". Why do I get this error message & how can I fix it?enter image description here

https://drive.google.com/drive/folders/1CVQK5YHudM8G1Synq1NRIzxOU14KgikH?usp=sharing

in Engine by (12 points)

1 Answer

+1 vote

Because you are not using correct node paths. I'm assuming this script is on fighter.

Writing $fighter means get_node("fighter"), which means "Get a child of this node named 'fighter'". fighter doesn't have a child named "fighter", so you get a "null instance".

In addition, you're also trying to use $fighter2, which also isn't a child of the scripted node. The path from fighter to fighter2 would be "../../fighter2/fighter2". I don't know why each of your Sprites has a Node2D parent, but that's another issue.

If you're having trouble understanding node paths, you might find this helpful:

http://kidscancode.org/godot_recipes/basics/getting_nodes/

by (20,895 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.