I'm currently working on a 2D platformer with ladders. I'm hoping to centre the Player on the ladder on the X axis for him to climb.
The ladder is an Area2D and emits a signal to say that the Player has entered it.
In the Player script, I wish to centre the Player to the ladder, however I don't have a reference to the Ladder.
I wish to use something like this:
player.position.x = ladder.position.x
I have a main script on Level_01, but I realise that as the game eventually will have more levels things might break if I hard reference the Ladder (least I think so).
What's the best way to reference the Ladder's position?
If possible, could you supply some code to make it easier to understand?