1

In Untrusted, how can I get past the lasers? I'm assuming I need to use my phone, but even removing the strokes of the lazers still makes me get hit by them.

enter image description here

3
  • Alternative solution: close the createLaser definition, then redefine createLaser to not do anything. Apr 10 '14 at 5:12
  • @user2357112 post as an answer if it worked for you Apr 10 '14 at 11:58
  • @user2357112 That solution no longer works in recent versions of untrusted.
    – pppery
    Jul 20 '19 at 16:45
4

You can use the code below to display the lasers (in their correct color) and also give your phone the ability to change your color. As you move, use Q to cycle through your colors until you can pass through the lasers. Cycle goes: (Green ->) Red -> Yellow -> Teal -> Red

var ctx = map.getCanvasContext();
ctx.beginPath();
ctx.strokeStyle = color;
ctx.lineWidth = 5;
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.stroke();

map.getPlayer().setPhoneCallback(function(){
    if(player.getColor()=='red')
        player.setColor('yellow');
    else if(player.getColor()=='yellow')
        player.setColor('teal');
    else
        player.setColor('red');
});

enter image description here

3
  • 1
    Thanks! I hate how I find out the answer just as you're posting them! Lol Apr 9 '14 at 18:15
  • @CanadianLuke Ask the question, get an answer. I'm stuck on level 19 for now.
    – Batophobia
    Apr 9 '14 at 18:18
  • You just wanting the extra rep? Good, cause I'm stuck on the next one now lol Apr 9 '14 at 18:23
3

override

getRandomInt = function(){return 600;};

and all lasers are drawn off screen/out the way

2

If you are too lazy to think about a true solution... :)

// ... ctx.stroke(); 
map.getPlayer().killedBy = function() { }; 
2

or just change the color of all lasers

color=player.getColor();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.