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

  • Alternative solution: close the createLaser definition, then redefine createLaser to not do anything. – user2357112 supports Monica Apr 10 '14 at 5:12
  • @user2357112 post as an answer if it worked for you – Canadian Luke 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

| improve this answer | |
  • 1
    Thanks! I hate how I find out the answer just as you're posting them! Lol – Canadian Luke 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 – Canadian Luke Apr 9 '14 at 18:23
2

override

getRandomInt = function(){return 600;};

and all lasers are drawn off screen/out the way

| improve this answer | |
1

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

// ... ctx.stroke(); 
map.getPlayer().killedBy = function() { }; 
| improve this answer | |
1

or just change the color of all lasers

color=player.getColor();

| improve this answer | |

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.