Beating the boss thingy

Solution 1:

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.

Solution 2:

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');
});

Solution 3:

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

Solution 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');
});

}