It would be a better plan to use flags rather than moveXY inside the while True loop. Otherwise you’ll have to keep doing the moveXY statements even when you’ve already got past that stage in the level. Also you need to add something in front of
Otherwise you’ll do it even if there aren’t any enemies.
Finally, I wouldn’t move this far:
It just means you take more damage to the yeti.
I can clarify this if you need me to, but please could you post your new code first.
Danny
I’ve got quite a few suggestions which almost make your hero win (you’ll have to try some different tactics to win, but with these tips it almost works, for me at least).
Your } from if (flag) { includes the var enemy and hero.attack(enemy);. You don’t really only want to attack an enemy when there’s a flag. Also, make sure you put if(enemy) in front the hero.attack(enemy). You might also only want to have one hero.attack(), if the code is looped (which it is), you don’t need two statements because it will just repeat anyway.
This kind of wastes time now, so you can probably remove it.
You might want to add something like && hero.time >= a certain number, so that you only summon soldiers in the right place, rather than having them lying around the map in inconvenient places.
You should do var enemy = soldier.findNearestEnemy() otherwise all the soldiers will attack the same skeleton, which is very inefficient and wastes most of their attack.
I hope this helps,
Danny
I took your first code, modified it and pasted it in another session taken from the leaderboard. You can see a flag, but in reality it hasn’t been used. Boss star I, Sword of the Forgotten.
Some soldiers died, if you want to see other strategies without casualties use the search i have posted 4 short animations. ( and creating the videos is the hardest thing )
If to think from the game point, you’ll just get bored, when you get code to all levels.The game loses sense.And here, if we post solution, other players might read it too.That won’t be nice.