def moveBothTo(point):
while hero.distanceTo(point) > 1:
hero.move(point)
hero.command(peasant, "move", point)
peasant = hero.findNearest(hero.findFriends())
while True:
# Command your friend to build a decoy towards x + 1:
hero.command(peasant, "buildXY", "decoy", peasant.pos.x + 2, peasant.pos.y)
nextPoint = {"x": hero.pos.x, "y": hero.pos.y + 28};
moveBothTo(nextPoint)
# Create a new x/y dict +28 units away in the x dir:
nextPoint = {"x": hero.pos.x + 28, "y": hero.pos.y}
# Find the nearest enemy:
enemy = hero.findNearestEnemy()
if enemy:
# While the enemy's health is > 0:
while enemy.health > 0:
# Attack the enemy:
hero.attack(enemy)
pass
# Update the variable to the next nearest enemy:
enemy = hero.findNearestEnemy()
moveBothTo(nextPoint)
https://codecombat.com/play/level/distracting-dungeon?
My hero only kills the first ogre, not the second one.
Lydia