Interception glitch level is impossible? (javascript)

hey guys my peasant gets too far from the hero and my hero then defines the soldier athe nearest friend help!
here is my code:

// Stand between the peasant and the tower.

while(true) {
    var enemy = hero.findNearestEnemy();
    var friend = hero.findNearestFriend();
    // Calculate x by adding friend.pos.x to enemy.pos.x
    // Then divide by 2.
    // Check the guide if you need more help!
    var x = (friend.pos.x + enemy.pos.x) / 2
    var y = (friend.pos.y + enemy.pos.x) / 2
    // Now do the same for y
    hero.moveXY(x, y);
    // Move to the x and y coordinates you calculated.

If you have the method hero.findByType() unlocked, use that to find the nearest peasant, otherwise it’s probably the hero.moveXY() being too slow; if you can, use hero.move().

ok thank you @JustALuke I will try hero.findByType

how do i mark this as solved I solved it

There is a mark near every post in a level-help topic, you click on it and the topic closes.

i cant see it :confused: @Chaboi_3000 can u close this

Try now. I changed the category of the topic to Level Help.

1 Like

thank you peter 20chars

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.