Topic was automatically imported from the old Question2Answer platform.
Asked By
danielmeridew
I’ve been back to this issue several times now…
I hold a reference to the player in singleton Global.player.
There are times where I want to take the player’s global_position as a value so I can use the player’s previous position later e.g. for an air strike, or enemy charging movement.
There is no .duplicate() for global_position, there must be a simple one-liner for this kind of thing?
Not sure what was unclear in the answer and comments to your previous question, but if you assign a vector to another variable, that “copies” it. If you really want to be explicit about it you can pass a vector to one of the vector constructors:
var player_current_position = Vector2(Global.player.global_position)