Accessing a scene's position from another scene

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

Hey!
I have a player scene and i am implementing grid based movement. I want to access and change the position of the player from another scene which is a TileMap. How do i go about doing this? Also i do want the player to be a separate scene. The player is a sprite type of node.
Thanks!

:bust_in_silhouette: Reply From: jgodfrey

Typical methods would be the same as accessing any other node. So…

  • Get a reference to the player node from the scene tree and set its position directly
  • Use a signal to broadcast the new position and have the player receive and handle the signal
  • Store the player object in an Autoload so it can be referenced from the other scene