Hello everyone, i'm new to gdscript and i'm having some problems when trying to access another node, i'm trying to save the kinematicbody2d position when i press a button, the node is named "Objeto" and when i use get_node("Objeto) it returns null for some reason.
var coordenadax = get_node("Objeto").get("coordenadax")
var coordenaday = get_node("Objeto").get("coordenadax")
I'm trying to get the coordinates of the node into the button script so i can save it into a .data file. In my KinematicBody2D node, i have this to update the position all he time:
var pos = get_position()
coordenadax = pos.x
coordenaday = pos.y
How can i save the node's position and access it from another node?
In the beginning of the script i have the two variables initialized as:
var coordenadax =0
var coordenaday =0
I tried putting the node Objeto as child of the button node but it gives me
"Attempt to call function 'get' in base 'null instance' on a null
Thanks in advance!