Do you have objects at the locations where the teleporting begins and ends (or, what lets the user know that their actor will be teleported at that point)? Do you only have one set of teleporting objects at a time (if any)?
setLocation(orbObjectToTeleportTo.getX(), orbObjecttoTeleportTo.getY();
This will teleport you to the orbObjectToTeleportTo object, but you might judt call it orb. So make sure to have a reference to the object you wanne teleport to.
Instead of trying to find code, try creating it. You already know that
- if actor touches orb, transport
and transporting involves
- find out location of other orb
- move actor to that location
The one problem you might encounter is if you allow two-way transporting, you will need some way of preventing the actor from returning immediately after arriving at an orb (the actor would repeatedly jump back and forth between the two orbs). The way to prevent it is to check if the actor has moved off the orb it has arrived at. An instance boolean can be used to indicate that transport was executed and you are now waiting for the actor to move off of the orb (at which point the boolean value should be reset).