how can i get a node outside my extended node

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By extorc

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

:bust_in_silhouette: Reply From: kidscancode

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:
    2D movement overview — Godot Engine (3.2) documentation in English