! need help (backwood forest)! [SOLVED]

On level Long-Range Division in Backwood Forest, my Code doesnt seem to Work.
Thats why i need Help.
This is my Code :

var enemy = hero.findNearestEnemy();
var distanceToEnemy = hero.distanceTo(enemy);
hero.say(distanceToEnemy / 3);

var distanceToEnemy2 = hero.distanceTo(enemy);
hero.say(distanceToEnemy / 1.5);

hero.say("Woo hoo!");
hero.say("Here we go!");

while(true) {   

My last Goal is to kill BOTH of the enemys. But my Code only kills one of the Enemy.
Can somebody help please ? :face_with_raised_eyebrow:

I only know python not JS, but in python we’re supposed to have the hero.findNearestEnemy() inside the while true loop. So would it help if you put everything but all the hero.say stuff inside a while true loop?

I think you don’t need this part. This might be takign up time where you are perhaps dying? can you send a link?

1 Like

This was in the level i didnt extra code it in.

Thank u @enPointe77, it worked. :grin:

1 Like

No problem, glad it helped!

dont forget to click the check box next to the comment that helped you most

He’s not even active anymore. This happened 6 months ago.