I changed it…
loop {
this.shield();
enemy = this.findNearestEnemy();
if (this.isReady(“cleave”))
(this.cleave(enemy));
else {
this.shield();
}
}
but I still end up dying,
help?
I changed it…
loop {
this.shield();
enemy = this.findNearestEnemy();
if (this.isReady(“cleave”))
(this.cleave(enemy));
else {
this.shield();
}
}
but I still end up dying,
help?
Hello, lolfrog, and welcome. Please format your code correctly according to the FAQ.
The comments say to attack if the opponent is less than ten meters away. Try doing that.
loop:
flag=self.findFlag("green")
if flag:
self.pickUpFlag(flag)
else:
enemy = self.findNearestEnemy()
# If there is an enemy, then...
if enemy:
# If the enemy is less than 5 meters away, then attack()
distance=self.distanceTo(enemy)
if distance < 5:
if self.isReady("cleave"):
self.cleave(enemy)
else:
self.attack(enemy)
else:
# Otherwise (the enemy is far away), then shield()
pass
self.shield()
# Otherwise (there is no enemy...)
else:
# then move back to the X
self.moveXY(40, 34)
…Okay, there’s some code. What do you want us to do with it?
¿ It the most optimal ?
If it works, then it’s fine.
Can you tell me a code ?
If you are asking for the solution, I will not give you a solution code. We like to encourage people to find the solution for themselves. If I told you the solution, it is all too likely that you will be back asking for the solution to the next level. And then the next.
On the other hand, if you are asking for help, I need you to tell me what problems you are encountering in your code.
You Can Pass unused flags level ?
Yes, I suppose I can.
what kind of code are you using?
I believe that Jorge_Lagos_Duarte was using python.
Here! Just use Python and remember to have a shield!
[redacted, we do not post correct code]
We don’t post correct code here on CodeCombat, especially if it’s not formatted properly.
no problem brother:watch: I also had problems with this level no need to be mad
Hey brother how do you do the last level brother yeah brother
self.moveRight()
self.moveDown()
self.moveRight()
yeah this is the code brother
cool brother I was stuck on the first level
yeah me to but you gave me the code brother do you not remember brother?
oh yeah that one time in that one place! I remeber the code thanks brother