by antimagic · 12y ago · 0 comments
map.placeObject(map.getWidth()/2, 5, 'block');
//map.placeObject(map.getWidth()/2, 1, 'block');
var player = map.getPlayer();
map.defineObject('missile', {
'type': 'dynamic',
'symbol': '^',
'color': 'blue',
'interval': 100,
'projectile': true,
'behavior': function (me) {
me.move('up');
}
});
function jericho()
{
var i;
for (i = 3; i < map.getWidth() - 3; i++)
{
map.placeObject(i, map.getHeight() - 1, 'missile');
}
}
player.setPhoneCallback(function()
{
jericho();
}); map.overrideKey('up', function() {
if (map.countObjects('boss') > 0) {
for (var x = 0; x < map.getWidth(); x++) {
map.placeObject(x, map.getHeight()-5, 'missile');
}
} else {
map.overrideKey('up', null);
}
});:-)
//Math.random = function(){ return false;};
/* my first Idea was to try and redefine Math.random to always return <0.3, but for some reason even though this did effect the dropping of bullets, it didn't stop them completely (if someone could explain this I would really appreciate it*/
map.defineObject('MagicBlock', {
'type' : 'static',
'symbol' : '$',
'color' : 'magenta',
'impassable' : function() { return map.countObjects('boss') >0;}
});
//place a row of MagicBlock's aboove the player's starting position
for(var i =0; i < map.getWidth(); i++)
map.placeObject(i, map.getHeight()-5, 'MagicBlock');
map.defineObject('missile', {
'type' : 'dynamic',
'symbol' : '^',
'interval' : 100,
'projectile': true,
'behavior' : function(me) { me.move('up');},
'color' : 'lime'
});
player = map.getPlayer();
function volley(){
for(var i = 0; i < map.getWidth(); i++)
map.placeObject(i, map.getHeight()-6, 'missile');
map.placeObject(i, map.getHeight()-7, 'missile');
}
map.getPlayer().setPhoneCallback(function(){
volley();
});for(ii=0;ii<23;ii++){ map.getDynamicObjects()[ii].direction='down'; }
f=function(){ map.placeObject(10, 18, 'bullet'); } map.getPlayer().setPhoneCallback(f);