Hi
here’s my level
issue:
trying to set moveXY as dynamic variables
coin = hero.findNearestItem()
if coin:
pos = coin.pos
x = coin.x
y = coin.y
hero.moveXY(x, y)
Throws an error.
I also tried:
elif item:
# Collect coins.
coin = hero.findNearestItem()
if coin:
pos = coin.pos
xc = coin.x
yc = coin.y
hero.move({"x": xc, "y": yc})
Also throws an error.
but the help uses the same code!
Uploading…
Is it because I’m using boots of jumping?!
thank you
Dennis
Here’s the full my code
# Collect coins. Ignore sand yaks and burls. Fight throwers and ogres.
while True:
enemy = hero.findNearestEnemy()
item = hero.findNearestItem()
if enemy:
if enemy.type is "sand-yak" or enemy.type is "burl":
# Don't fight sand yaks or burls! Just keep collecting coins.
hero.say("Get out of my way!")
pass
else:
# But if the enemy is type "thrower" or "ogre", attack them.
if enemy.type is "thrower" or "ogre":
hero.attack(enemy)
hero.attack(enemy)
pass
elif item:
# Collect coins.
coin = hero.findNearestItem()
if coin:
pos = coin.pos
x = coin.x
y = coin.y
hero.moveXY(x, y)
pass