0 votes

so , i started using godot a week ago and i have found that i need to use something known as onready var = $ to get nodes in scripts but i figured that in this way i cant get the nodes outside my extended node in the script , so can anybody explain how to do this
to make u understand better , i want to make a game in which the sprite follows the position of my mouse click

in Engine by (12 points)

1 Answer

0 votes

You seem to be asking two different questions.

1) You can use get_node() to get any node in the tree, you just need to use the correct path to the node, ie ".." to go up to the parent node, etc.

2) There is an example of using "click to move" in the docs:
https://docs.godotengine.org/en/3.2/tutorials/2d/2d_movement.html#click-and-move

by (20,475 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.