I’m using Twilight Glasses and I have the Boss Star 2 in this level. According to the latter I should be able to command peasants. But I’m having trouble making peasants collect coins.
For example the following code:
item = peasants.findNearestItem()```
displays a mistake "peasants has no method findNearestItem".
Am I missing something?
Yes. You are defining find by type peasants. Which finds more than 1 peasant. Try using a for statement like such : For peasant in peasants: because, this does the command for each peasant individually, instead of just trying to send them all that once.
Thx a lot! For some reason I got stuck here. I’ve used the “for” statement, but did it incorrectly. You’ve stated the obvious, but it really helped me a lot. Thx again!
i need help with my code, my hero makes it to the end, but only collects around 170 coins, not anywhere near the needed amount. Do i need to upgrade my speed?
Code:
I think the problem is every time you have enough gold to summon, you waste it all and then command them to attack the fang rider, which takes too much time. Instead of summoning so many soldiers, use an if statement such as if there is an enemy within for example 5 meters, attack it, otherwise, ignore it and finish collecting your 256 coins.