Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Dueling Grounds - target a unit


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)
enemy = self.findEnemies()


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.


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


self.moveXY(46, 18)
self.moveXY(62, 31)
self.moveXY(63, 16)
enemy = self.findNearestEnemy()

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


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.