I am not able to get the code for hoarding gold to work. I have tired various bits of code to tell Naria how much. Everytime it tells her 25 when I collect 27 or another random number. Suggestions as to what I might be doing wrong?
totalGold = 0 loop: coin = self.findNearestItem() if coin: # Pick up the coin. coinPos = coin.pos cx = coin.pos.x cy = coin.pos.y self.moveXY(cx, cy) totalGold += coin.value # Add the coin's value to totalGold. (See the guide for more.) # Get its value with: coin.value pass if totalGold >= 25: self.say ("I'm Done Collecting gold") self.moveXY(58, 33) self.say ("I have collected " + totalGold + " gold!")
I have tried both the above and also