Ich denke, meine Lösung ist etwas besser.
DER ANTI-BOSS !!!
// DIE WAND
map.defineObject ('b', {'symbol': '#', 'color': 'blue', 'unpassierbar': true}); for (var i = 3; i<47; i ++) {map.placeObject (i, map.getHeight () - 6, 'b');}
// THE ANTI BOSS
map.defineObject ('AntiBoss Bullet', {'Typ': 'dynamisch', 'Symbol': '.', 'Farbe': 'blau', 'Intervall': 100, 'Projektil': wahr, 'onCollision': Funktion (Boss) {Boss.killedBy ('der ANTI BOSS');}, 'Verhalten': Funktion (Aufzählungszeichen) {Bullet.move ('Up');}}); map.defineObject ('AntiBoss ', {' type ':' dynamic ',' symbol ':' ⊙ ',' color ':' blue ',' interval ': 100,' behaviour ': 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');});
}