Level 6 - Getting past the drone

Level 6 - Getting past the drone - Free stock photo of aesthetic, apple pie, at home

In level 6 of Untrusted, how do I avoid the attack drone? I've tried creating a new object type that could act as a blocker, but the drone manages to get around it, and I'm convinced there has to be an easier solution that I'm just not seeing.



Best Answer

You can actually rebind the moveToward variable, and the re-bound function will be used by the drone. This allows you to trivially reprogram the drone to do movement you want.




Pictures about "Level 6 - Getting past the drone"

Level 6 - Getting past the drone - Free stock photo of adult, business, coffee
Level 6 - Getting past the drone - Drone Shot of a City Skyline
Level 6 - Getting past the drone - Free stock photo of abstract, adventure, aerial view





Batman: Arkham Knight - Getting Past the Drones in the Sewers




More answers regarding level 6 - Getting past the drone

Answer 2

or you can build self defences drones :)

map.defineObject('selfDefenceDrone', {
'type': 'dynamic',
'symbol': 'X',
'color': 'green',
'onCollision': function (player) {
player.killedBy('an attack drone');
console.log('killled!');
},
'behavior': function (me) {
moveToward(me, 'attackDrone');
console.log(me.findNearest('attackDrone'));
console.log('-------------');
}
});

map.placeObject(map.getWidth()-9, 12, 'selfDefenceDrone');
map.placeObject(map.getWidth()-5, 16, 'selfDefenceDrone');
map.placeObject(map.getWidth()-5, 8, 'selfDefenceDrone');
map.placeObject(map.getWidth()-1, 14, 'selfDefenceDrone');

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Vlada Karpovich, cottonbro, Дмитрий Трепольский, Polina Kovaleva