while true:
enemy = hero.findNearestEnemy()
if enemy:
#if the enemy is to the left of the hero:
if enemy.pos.x < hero.pos.x:
#buildXY "fire trap" on the left X.
hero.buildXY("fire trap fence", 25, 34 )
pass
#if the enemy is to the right of the hero:
elif enemy.pos.x > hero.pos.x:
#buildXY a "fire trap" on the right X.
hero.buildXY(fire trap fence", 55, 34)
pass
if the enemy is below the hero:
elif enemy.pos.y < hero.pos.y:
#buildXY a "fire trap" on the bottom X.
hero.buildXY(fire trap fence", 40, 19)
pass
#if the enemy is above the hero":
elif enemy.pos.y > hero.pos.y:
#buildXY a "fire trap" on the top X.
I am doing python.
hero.buildXY("fire trap fence", 40, 19)
pass
#Move back to the center.
hero.moveXY(40, 34)
#Use "fire traps" to deafeat ogres.
while true:
enemy = hero.findNearestEnemy()
if enemy:
#if the enemy is to the left of the hero:
if enemy.pos.x < hero.pos.x:
#buildXY “fire trap” on the left X.
hero.buildXY(“fire trap fence”, 25, 34 )
pass
#if the enemy is to the right of the hero:
elif enemy.pos.x > hero.pos.x:
#buildXY a “fire trap” on the right X.
hero.buildXY(fire trap fence", 55, 34)
pass
if the enemy is below the hero:
elif enemy.pos.y < hero.pos.y:
#buildXY a “fire trap” on the bottom X.
hero.buildXY(fire trap fence", 40, 19)
pass
#if the enemy is above the hero":
elif enemy.pos.y > hero.pos.y:
#buildXY a “fire trap” on the top X.
I am doing python.
hero.buildXY(“fire trap fence”, 40, 19)
pass
#Move back to the center.
hero.moveXY(40, 34)
@Jake_Doggy I’m confused. Is that @alinaqighulam’s code that you’ve put inside quote marks? That’s nice of you to try to help, but what we need is to see where he’s put indents, which don’t come out in the code above.
Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!