I don’t know why i can’t collect enough 300 coins, please help me to resolve it?
Accumulate 300 gold and escape from the dungeon.
def onSpawn(event):
goldCoin = pet.findNearestByType("coin")
if goldCoin:
# Send the pet to walk around the dungeon:
pet.moveXY(goldCoin.pos.x, goldCoin.pos.y)
# Don't forget to return it to the hero:
pet.moveXY(hero.pos.x, hero.pos.y)
pass
pet.on("spawn", onSpawn)
while True:
# Guard peasants:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
# When you have 300+ gold move to the red mark:
if hero.gold >=300:
hero.moveXY(50, 34)
pass
I have changed my code but it still return back 150 coin #
Accumulate 300 gold and escape from the dungeon.
def onSpawn(event):
pet.moveXY(32, 56)
pet.moveXY(63, 55)
pet.moveXY(73, 14)
pet.moveXY(43, 7)
pet.moveXY(25,8)
# Don't forget to return it to the hero:
pet.moveXY(hero.pos.x, hero.pos.y)
# Guard peasants:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
# When you have 300+ gold move to the red mark:
if hero.gold >=300:
hero.moveXY(50, 35)
pass
the coins are being dragged BEHIND the pet
even if the pet moves to your position, not all the coins get collected.
also, u know the peasants mine 5 coins per second, so you can wait for 30 seconds and get the other 150 coins #1 rule about being a coder:
be creative