I’m still a little new to code combat. i just can’t get past Hold The Forest pass! This is my code:
loop {
var enemy = this.findNearestEnemy();
var flag = this.findFlag();
if(flag) {
// Pick up the flag.
this.pickUpFlag(flag);
} else if (enemy) {
this.attack(enemy);
else {
this.shield(enemy);
}
}
I’m not exactly sure what problem you are having? Error? always dying?
this.shield() is the command, but I’m not sure what you are expecting it to do, since the only time you try to use it is when there are no enemies…
Do you try to lead the ogres around to the archers?
What equipment are you using? Are you using the best you have?
I assume you are hitting submit, so you can place flags…
I’d suggest getting a flag before the level even starts, that way as soon as it has started you can issue your first order (go to the “X”, you know you’ve that part down when she say “Ogres! To Arms!” while move toward the X) Try to lead the whole first wave around to the archers. And after that as many as you can…
Although with the code you’ve put here you have unbalanced curly brackets, probably need one before the final else? Also shield doesn’t take any arguments. Are you having a problem with the code compiling?
I’d also make sure to use cleave in there, since that’s a great skill for clearing out a bunch of enemies and then darting away to your archers on this level.
make sure you are delete the this.attack because you dont want to sucide yourself since there is so many guys out there. I would suggested you by pickup the flag forth and back to your team archers let them kill for you…
That is very close to the solution I had for this, my difference was that IF there was an enemy I checked to see if I could cleave, if so I cleaved. If not I shielded.
I need help, it tells me to put a flag to retreat or fight in the battle. I place a flag but it doesn’t work.
My code is:
loop:
enemy = self.findNearestEnemy()
flag = self.findFlag()
if flag:
pass # Pick up the flag.
Nevermind, I got it! I stole the coding from the free coins level and then put that coding in. I will leave the rest up to you. Don’t wanna spit the answer! Heh!