hi this above all greetings to everyone, I’m learning to program new javascript I get stuck at the level Sarven Outpost
If someone takes pity and gives me a few tips that I have to do because when I attack no longer return to the path of movement and I think I have to do a circular motion.
Hola si alguien habla español seria genial para mi…
// Ogres are attacking a nearby outpost!
// Command the hero to defend the tiny settlement.
// Time your patrol with a watch so no ogres can get through.
while(true) {
var polarPos = hero.now() / 5;
var xPos = 40 + Math.cos(polarPos) * 20; // Number between 20 and 60.
var yPos = 34 + Math.sin(polarPos) * 20; // Number between 14 and 54.
hero.moveXY(xPos, yPos);
// Check for ogres and defeat them!
// Make sure to attack the ogres while their health is above 0.
var enemy = this.findNearestEnemy();
var distance = this.distanceTo(enemy);
while(enemy ){
hero.attack(enemy);
//enemy = false;
}
}