How can I add a node's position to an animationplayer property track or make the xy values relative to its own position?

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

I have an issue where I have an animationplayer on a node. it has a property track, animatedsprite track, and call method track. I’m trying to insert another node’s position to the property track so that wherever the node is, it moves to that specific node. Here’s what I’m trying to accomplish.
Theres a player node on the middle left of the screen and three enemy nodes on the right separated by 200 or so pixels in the y axis. The enemy nodes get instanced during runtime, not in editor, and right now, the property track has the transition of going from (0, 0) to (800, 0) then back to (0, 0). I thought the (0, 0) would refer to their separate starting locations, but they all teleport to the same starting location and do the same animation transitions.
So I’m basically trying to make the starting x and y values be the starting position of the enemy node and the ending x and y values be the position of the player node. But the animationtrackkeyedit only has numeral inputs for the x and y value. I combed through the animationplayer methods, but I haven’t found a method that lets me access specific tracks’ key’s values, if there was a way to do that, I feel like it’ll solve the issue. Another way I thought of was possibly making an animation node in the main game scene and add that animation node to the enemy node after its instanced in, but the editor doesn’t show the animation node?
Any help is appreciated. Been stuck thinking about this for a couple of days

:bust_in_silhouette: Reply From: poopfeast420

dug through the docs and found you can access the key values through node
example line code
enemy.animation.get_animation(“attack”).track_set_key_value(0, 0, Vector2(enemy.rect_global_position.x, enemy.rect_global_position.y))