Invalid get index ‘position’ (on base: ‘null instance’). is the error I get
I really need this to work since without enemy’s last position the item just spawns at a far location
That error means that get_node("Enemy") is returning null. That means that either the node is not named that, or you have the incorrect path to the node.
get_node("SomeNode") means “Get a node named ‘SomeNode’ that’s a child of this node.” You might want to share a picture of your scene tree, but it seems that you’d probably need to say get_node("Enemy/Enemy").
also tried to set position to the AnimatedSprite node of the main node(or root node?) Enemy
var poz = $AnimatedSprite.position
and it’s still Invalid get index ‘position’ (on base: ‘null instance’)
WelpHelp | 2019-04-21 23:33
Your script is attached to the Enemy node (if I understand that screenshot correctly).
Theat means “Enemy” is the node itself which can be referenced with self as well as get_node(".") but can also simple be omitted.
So it is here: var poz = position (or var poz = self.position )