Again, i will put this into Python terms
hero.moveRight()
hero.moveUp()
enemy = hero.findNearestEnemy()
hero.attack(enemy)
hero.attack(enemy)
hero.moveRight()
hero.moveDown(2)
hero.moveUp()
Again, i will put this into Python terms
hero.moveRight()
hero.moveUp()
enemy = hero.findNearestEnemy()
hero.attack(enemy)
hero.attack(enemy)
hero.moveRight()
hero.moveDown(2)
hero.moveUp()
it says that there is too much indentation at the beginning
(loop)
self.moveRight() right here
self.moveUp()
enemy = self.findNearestEnemy()
self.attack(enemy)
self.attack(enemy)
Why are you using self? Are you using someone else’s code, or have you started again from playing ages ago?
Danny
P.S. loop doesn’t work any more either.
I’ve started again from playing ages ago @Deadpool198
I thought that might be it; well, I would suggest just reloading the level (the bottom in the top right of the level screen) and starting again with the new functions:
while True instead of loop and hero instead of self.
I do not remember how I beat it sorry but I will be of no help
oof srry but I can’t help
why can’t we post the solutions we have?
Because it completely ruins the conception of learning) We have to find solutions by ourselves not to copypaste ones we see from other players on the forum or elsewhere.
oh ok thanks for telling me
use a for loop instead?
there is a prob in my code after I kill the second enemy I die because my code loops me going up and I get hit by the spikes!
Hi @Spacemanic and welcome to the forum!
Can you show us your code formated as it is described here so we will help you solve the level?
while True:
hero.moveRight()
hero.moveUp()
hero.moveRight()
hero.moveDown()
hero.moveDown()
hero.moveUp()
hero.moveRight()
enemy = hero.findNearestEnemy()
hero.attack(enemy)
hero.attack(enemy)
this is it
Try to format it as it is described here.
Many thanks, will give that a try
Hi, I don’t really need help it’s just that I don’t understand why I don’t have more levels in Dungeon. This is a screenshot of my map.
Are you a sub? 20 chars
wdym? 20 characters(
Are you a subscriber?