Hello,
I am playing the dunes now, and everything works fine, except when a thrower appears in screen. Then self does not continue to other sentences until the thrower is dead.
Here is my code:
loop:
enemy = self.findNearestEnemy()
item = self.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.
pass
# But if the enemy is a 'thrower' or an 'ogre', fight them.
elif enemy.type is 'thrower' or enemy.type is 'ogre':
if self.distanceTo(enemy) < 30:
#To keep collecting while the enemy is far
if self.isReady('cleave'):
self.cleave(enemy)
elif self.isReady('bash'):
self.bash(enemy)
else:
self.attack(enemy)
else:
pass #I think the problem is here
elif item:
# Collect coins.
self.say('collecting') #To check if the action is taking place
pos=item.pos
X=pos.x
Y=pos.y
self.moveXY(X,Y)
The funny thing is that self does not do anything when a thrower appears if I delete the sentence self.say(‘collecting’) or if I change the distance to enemy necessary to start attacking.
Thanks!