In Level 17, how can I set the teleports to only teleport to other safe zones? Since the teleporters change every time you set the map, this is the only thing I can think of.

enter image description here

4 Answers 4


There are several things you can do here. You've got a bunch of information about the teleporters and traps at your disposal. You could do something that exposes the links that have been created, or you could override those links.

Additional hints, protected by spoiler space:

The previous level shows you how to draw lines on the canvas, so you could draw lines to represent the connections this loop is creating. I think this is what the title of the level ("pointers") is getting at.

Drawing lines for each link is kind of overly verbose, so you might want to check the type and only show the links that are between teleporters.

If you can expose all the teleporter-to-teleporter links, there's a chance you can make it to the bottom right, but it's hard to see the lines and kind of a crapshoot as to whether or not the teleporters actually connect.

Since you know where all the teleporters are (getCanvasCoords), can't you find the fastest route? You want to go from the extreme upper left to the extreme lower right, correct?

What I did was hijack the loop in the code, and use it to find the upper left teleporter and connect it to the lower right one directly, then break out of the loop before any other connections are made. It's a bit brute force, but it worked: https://gist.github.com/agent86ix/0c1615791c05664c99fb

  • This does not seem to work all the time. I tried your code and ended up in the bottom left area.
    – Batophobia
    Commented Apr 9, 2014 at 20:22
  • @Batophobia, odd. I'll look into it and see if I can fix the code.
    – agent86
    Commented Apr 9, 2014 at 21:33
  • @Batophobia, I didn't update the X values when the Y values changed, which I think was the problem. I ran it about 10 times in a row now and it seems to work.
    – agent86
    Commented Apr 9, 2014 at 21:37
  • I was having the same issues on the code I was trying to use, but I got lucky on one Execute command.
    – Batophobia
    Commented Apr 9, 2014 at 22:31
  • 1
    And in playing with a new method I found its easy enough to just hardcode coordinates for one of the teleporters in the exit room and then just set all teleporters to teleport to that. Works pretty well, means only having to find one specific teleporter and means there is no possibility of unsolvable levels which just marking them would leave.
    – Chris
    Commented Apr 9, 2014 at 23:26

Just like @agent86, I decided to hijack the loop. My solution is slightly shorter and links all 3 teleporter near the player to the ones near the exit.

var player = map.getPlayer();
var entry = [], exit = [];

for (i = 0; i < teleportersAndTraps.length; i++) {
    var t = teleportersAndTraps[i];
    if (t.getType() == 'teleporter') {
        if (Math.abs(t.getX() - player.getX()) <= 2 &&
            Math.abs(t.getY() - player.getY()) <= 2)
        if (Math.abs(t.getX() - (map.getWidth() - 10)) <= 2 &&
            Math.abs(t.getY() - (map.getHeight() - 5)) <= 2)

for (i = 0; i < 3; i++)


Basically, I'm looking for any teleporter that has a x- or y-distance of 2 or less to the player or the exit.


What i did is link each teleporter in the list to the teleporter that comes after it in the list, and because of that all the teleporters form one big loop. all i did was just always enter the teleporter i just went through, and after a few teleports i got to the exit.

  • Details? Code? Need more details Commented Mar 17, 2015 at 5:43

In my case these solutions did not convince me. I actually just didn't like the idea of linking directly to the exit, what I did was looking for each teleporter for one a step closer to the exit, that way, no matter the path you choose, you will always end up where you want (the exit) by using the teleports and without any risk of falling into the traps (unless I guess if you jump into the last row or column of teleports, I tried and it actually crashes if you the link is empty [edit: actually not, it does not crash, I realized it just takes a little bit of time to load it and there are still traps in the last rows/columns, it might not be the most efficient timewise]... but hey, it works! hahaha).

Here is my code if you want to look at it: https://gist.github.com/Untrusted-Game/5f78e8633962adc9d34e28ecebac1e4a

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .