Dueling Grounds - target a unit


#1

Hi. I’m stuck at dueling grounds. On line 11 it says that I need to target a unit when in fact I am - the enemy. Here is my code.

# Defeat the enemy hero in a duel!

# Find and attack the enemy inside a loop.
# Use flags and your special moves to win!
self.moveXY(64, 14)
self.moveXY(54, 16)
self.moveXY(53, 19)
self.moveXY(43, 19)
self.findEnemies()
enemy = self.findEnemies()
self.attack(enemy)

#2

Same problem as before: findEnemies() on your Mahogany Glasses gives an array of enemies. You want to combine it with findNearest to get the nearest single enemy.


#3

Ok thanks. I’ll try to figure it out myself next time. Sorry! :smile:


#4

loop:
self.shield()
self.moveXY(46, 18)
self.moveXY(62, 31)
self.moveXY(63, 16)
enemy = self.findNearestEnemy()
self.cleave(enemy)
self.attack(enemy)

I’ve used this… I’ve defeated the enemy but why ?? the Goals still “FAILING” ???


#6

Do you die at or around the same time as your enemy? If so, then the goal “Your hero must survive” will fail causing you to fail the level.