Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Confusion On Multiplayer Treasure Grove

#1

I used this code to win the AI Game:
During the use of this code, my character Tharin tries to walk through the fence on the edge of the battleground. Is this a bug or a problem in my code?

if hero.time < 200:
        coin = hero.findNearestItem()
        hero.moveXY(coin.pos.x, coin.pos.y)
        
0 Likes

#2

It’s a problem with the move function you’re using. Try reaching coins using coin.pos.

0 Likes

#3

Okay. Thank you @xython! Also, why is it that when I try to attack, my character afterwards won’t go back to coin-collecting?

0 Likes

#4

You can see this post Marauder: complicated way is only slightly better to find how I cope usually with coins and enemies. As a side note - I almost never use
moveXY() and try to substitute it with move(). Even with the best moveXY boots and trying to do some tricks I cannot reach the effectiveness of advanced move boots. If you continue to have problems after reading some posts show here your code.

0 Likes

#5

I found a code that works for me.

if hero.time < 500:
        coin = hero.findNearestItem()
        hero.moveXY(coin.pos.x, coin.pos.

I just want it to be faster.

0 Likes

#6

You can just do

while(True)
    coin = hero.findNearestItem()
    if coin:
        hero.move(coin.pos)
0 Likes

#7

Am I allowed to try this code on CoCo?

0 Likes

#8

I guess so… (200000000)

0 Likes

#9

It doesn’t work. Tharin doesn’t move, and it causes my code to be errored.

0 Likes

#10

Copy it again (2000000000)

0 Likes

#11

Buy these boots and when you advance more these:

0 Likes