please help me on Mad Maxer this is my code
loop:
farthest = None
maxDistance = 0
enemyIndex = 0
enemies = self.findEnemies()
while enemyIndex < len(enemies):
target = enemies[enemyIndex]
enemyIndex += 1
distance = self.distanceTo(target)
if distance > maxDistance:
maxDistance = distance
farthest = target
if farthest:
while farthest.health>=0:
if self.isReady("bash"):
self.bash(farthest)
else self.attack(farthest)
Grzmot
September 18, 2020, 10:09pm
2
Hi @Gabriel_Knight , you have 2 issues with your code. The first one is this:
Gabriel_Knight:
loop:
In python, this will never work, what you need to do is have a while loop like this:
While True:
The second issue with your code is this:
The indention and placement is wrong. It should look like this:
else:
self.attack(farthest)
Hope this helps!
Grzmot
Gabriel_Knight:
self
I don’t know if Python will work with self, if it works great! If it doesn’t work, try changing it to
hero
And try what @Grzmot said.
Lydia
Grzmot
September 19, 2020, 2:33am
4
Yes, self does work in python, but like other people, I just learned to use hero instead, so that’s what I stick with.
Grzmot
Oh ok. I learned Python with hero too, so I was confused.
Lydia
have u passed the level @Gabriel_Knight ?
@Gabriel_Knight Have you passed the level?
Lydia
if you have please check the box that says solution next to the comment that gave u the answer
sorry no I did not pass the level my motem router went out so I could not hop on. sorry for answering so late.
also I tried what Grzmot said and it did not work it almost worked though but
the decoys just got in the way and pushing my character back so I could not attack the ogre thing that can shoot blue stuff.
Could you post your lastest code and can you send me a link to this level?
Thanks, Lydia
wait I just put on the sword of the forgotten and it worked fine.
Congrats on solving it!! Don’t forget to do that little tick mark next to the comment that helped you solve this level!
Lydia