i need help with If-stravaganza level an here is my code:
– Defeat the ogres from within their own camp!
while true do
local enemy = hero:findNearestEnemy();
– Use an if-statement to check if an enemy exists:
if enemy then
hero:attack(enemy)
hero:attack(enemy)
end
end
// Use your new "cleave" skill as often as you can.
hero.moveXY(23, 23);
while(true) {
var enemy = hero.findNearestEnemy();
if (hero.isReady("cleave")) {
// Cleave the enemy!
}
else {
// Else (if cleave isn't ready), do your normal attack.
}
}
here
Thank you.
I don’t code JavaScript, but can still process the basics.
What do you need help on? Could you please explain and elaborate on what you’re stuck on?
// Use your new "cleave" skill as often as you can.
hero.moveXY(23, 23);
while(true) {
var enemy = hero.findNearestEnemy();
if (hero.isReady("cleave")) {
// Cleave the enemy!
hero.electrocute(hero.findNearestEnemy());
}
else {
// Else (if cleave isn't ready), do your normal attack.
}
}