Copy from an article I made a while ago on another place.
Unidirectionnal teleportation will allow you to create teleporters that leads it’s pair, but only in one direction (instead of both directions).
To make one, you just need to modify a bit the tags of your teleporters.
Name the first one as you would normally do (t+label+(1 or 2)) example: ta2
Then the second teleporter’s name will be a bit different. You must name if as a normal other, but you will also add another character at the end, for example: ta1*
Then, you’ll be able to travel from ta1* to ta2 but not from ta2 to ta1*!
Knowing how to do this is funny, but not as much as understanding it.
This the point of this part.
So, in order to understand why does it work, I opened the game with the software JPEXS Free Flash Decompiler, and searched through the code to find this function:
As you can see by it’s name, this function aims to initialize tps, pairing each one with it’s twin.
As you (already I think) now, to label a teleporter, you use the character ‘t’ followed by another character which will be the id of the teleporter, and finally, you use character 1 or 2 to inform if the teleporter is an entry/exit.
In the code, the id letter is registered in this.letter and the type in this.type.
The important fact to remark is that the substr function will only take the 3rd letter as type and no more.
Then comes the conditionnal structures which are used to pair the entry teleporter with it’s exit.
What is written there is:
- if the type of your teleporter (this.type) equals to 1, then it’s partner’s label will be ‘t’+this.letter+’2′
- if the type of your teleporter (this.type) equals to 2, then it’s partner’s label will be ‘t’+this.letter+’1′
These conditions allow us to create tps that are linked with another in only one direction.
If you didn’t understand, let’s take a look at a small example:
Let the first tp’s label be “ta1*” and the second “ta2”
During the init function these will be the values:
this.letter = ‘a’ // the id of our teleporter is here
this.type = ‘1’ // only the third character, the ‘*’ isn’t here
and at the end of the first if:
this.partner = “ta2”
This is totally normal, but when “ta2” will be initialized, it’s partner will switch to “ta1” and not “ta1*”
There you are, I hope you found it interesting!