6

Almost there! I'm on level 20, with the boss. I added a wall so I could get at the phone, but the exit requires the Algorithm! To get it, I must destroy the boss... But if I collide with the boss, it's the player who dies, not the boss. What can I do?

4
  • 1
    Wow, everyone else fought the boss. I didn't figure out how destroying the boss even works; I just overrode hasItem to pretend I had the Algorithm. Pacifist run! Apr 10, 2014 at 5:03
  • There is a check to make sure the boss is defeated when you have the algorithm Apr 10, 2014 at 12:01
  • Doesn't matter. It doesn't actually create another theAlgorithm object; it just dummies out the check for whether we have it. Apr 10, 2014 at 12:02
  • 8 different solutions: gist.github.com/mhasdf/…
    – mh543
    Nov 21, 2022 at 8:04

7 Answers 7

6

You have 1 block that you can place. Put it somewhere in the middle so you can hide, wait for the boss to move to the other side, and then you can get the phone.

enter image description here

After getting the phone, you need a way to attack the boss. Call me old-fashioned, but I prefer to fight head-on.

enter image description here

Here is the code

map.placeObject(35, 22, 'block');
map.defineObject('missile', {
        'type': 'dynamic',
        'symbol': '|',
        'color': 'blue',
        'interval': 100,
        'projectile': true,
        'behavior': function (me) {
            me.move('up');
        }
    });
map.getPlayer().setPhoneCallback(function(){
var hero=map.getPlayer();
map.placeObject(hero.getX(), hero.getY()-1, 'missile');
});

You could change me.move('up'); to me.move('left'); if you do not want to fight fair.

9
  • Apparently, I shouldn't fire too much... I got killed by my own missile the first time! Apr 9, 2014 at 22:41
  • 3
    You can also just stop the boss from firing with Math.random = function() { return 0.4; } Apr 10, 2014 at 2:28
  • 2
    @JonathanCampbell Guaranteed to be random.
    – Batophobia
    Apr 10, 2014 at 2:50
  • 1
    @SysDragon Great minds think alike
    – Batophobia
    Apr 11, 2014 at 21:34
  • 1
    I just found out something interesting about this map: If you "walk" in the line immediately below the bosses (line 7), and stay immobile while the bosses pass near you, the shots will fail to create because "Can't place object on top of the player", so, you actually need no cover, just wait until all the bosses has passed you and move on to get the phone. Sep 29, 2015 at 1:32
4

Bah to other answers using blocks to hide! We don't need to hide! Take that boss on!

Check your API. There's a function you can use to override up, down, left, or right to do something else. Since you don't actually need to use left, rejigger it to blast the snot out of the boss with an overwhelming show of force.

Here's my anti-bullet barrage, launched by pressing left:

map.defineObject('antiBullet', {
    'type': 'dynamic',
    'symbol': '*',
    'color': 'blue',
    'interval': 100,
    'projectile': true,
    'behavior': function (me) {
        me.move('up');
    }
});

map.overrideKey('left', function()
{    
  for (var i = 10 ; i < 20 ; ++i)
    for (var j = 0 ; j < map.getWidth() ; ++j)
      map.placeObject(j, i, 'antiBullet');
});
4

Math.random() isn't really random anyway, right... ? :)

Math.random = function() { return 555 };  // that removes bullets 
map.getPlayer().hasItem = function(a) { return true; }; // that makes game think you have everything
2
  • 3
    This could probably be used for just about every level.
    – Batophobia
    Apr 14, 2014 at 15:20
  • The second part of this answer no longer works in recent versions of Untrusted.
    – pppery
    Aug 18, 2019 at 23:50
4

I think my solution is a little more apropos.

THE ANTI BOSS!!!

enter image description here


//THE WALL

map.defineObject('b', {
    'symbol': '#',
    'color': 'blue',
    'impassable':true
});

for(var i=3;i<47;i++){
    map.placeObject(i, map.getHeight() - 6, 'b');
}

//THE ANTI BOSS

map.defineObject('AntiBoss Bullet', {
    'type': 'dynamic',
    'symbol': '.',
    'color': 'blue',
    'interval': 100,
    'projectile': true,
    'onCollision': function (boss) {
        boss.killedBy('the ANTI BOSS');    
    },    
    'behavior': function (bullet) {
        bullet.move('up');
    }
});
map.defineObject('antiBoss', {
    'type': 'dynamic',
    'symbol': '⊙',
    'color': 'blue',
    'interval': 100,
    'behavior': function (antiBoss) {
        if (!antiBoss.direction) {
            antiBoss.direction = 'right';
        }
        if (antiBoss.canMove(antiBoss.direction)) {
            antiBoss.move(antiBoss.direction);
        } else {
            antiBoss.direction = (antiBoss.direction == 'right') ?'left' : 'right';
        }
        if(map.countObjects('boss')>0){
            if (Math.random() < 0.3) {
               map.placeObject(antiBoss.getX(), antiBoss.getY() - 2, 'AntiBoss Bullet');
            }   
        }
    }
});
var player=map.getPlayer();
player.setPhoneCallback(function(){
    var posX=player.getX();
    var posY=player.getY()-4;
    map.placeObject(posX, posY, 'antiBoss');
});

}

3

I found carpet bombing a good technique:

map.placeObject(25, map.getHeight() - 4, 'block');

var player = map.getPlayer();
player.setPhoneCallback(function(){
    for(var i = 0; i<map.getWidth(); i++)
    {
        map.placeObject(i,4, 'bullet');

    }
});

The first line gives you a hiding point. The second creates a lot of bullets that will then instakill all the bosses (just make sure you are still in cover).

Edit: It seems that my original two rows of bullets on adjacent rows didn't always work (sometimes did, sometimes didn't). I think that sometimes the bullets just killed each other...

2

There is a way to kill a bos without using phone, adding block or doing any risky tricks.

map.overrideKey('left', function() {
    var me = map.getPlayer();
    map.placeObject(me.getX(), me.getY() + 1, 'bullet');
    var ob = map.getDynamicObjects();
    for (var i = 0; i < ob.length; ++i) {
        if (ob[i].getType() == 'boss') {
            try {
                ob[i].move('down');
            } catch (_) {}
        }
    }
});

Now you are not possible to go left, but you can move boss and shoot a bullet using left arrow on your keyboard. What do you need to do now:

  • Wait until boss is on the side of the string.
  • Press left arrow until all parts of the boss moved down.
  • Now there is a free row above the boss. Go here (remember that you will not be able to go left
  • Kill a boss by pressing left arrow
  • Go to the exit
1
  • Having to manoeuvre above the boss sounds like a risky trick to me! Nice trick on messing with their movement like that though.
    – Chris
    Apr 16, 2014 at 21:34
1

I just did it in two lines :).

map.getPlayer().hasItem = function(){return true};
map.getPlayer().killedBy = function(){};

Now you cant be killed and you have everything.

1
  • This no longer works in recent versions of Untrusted.
    – pppery
    Feb 17, 2020 at 21:31

You must log in to answer this question.

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