At level Decoy Drill,
i’m trying that :
# We are field testing a new battle unit: the decoy.
# Build 4 decoys, then report the total to Naria.
# Each decoy costs 25 gold. Use the Quartz Sense Stone
# to know when you have more than 25 gold with
# Keep a count of decoys you built as you go along.
# Break out of the loop when you have built 4.
decoysBuilt = 0
totalGold = 0
loop:
while decoysBuilt < 5:
item = self.findNearest(self.findItems())
if item:
position = item.pos
x = position.x
y = position.y
self.moveXY(x, y)
totalGold = totalGold + item.value
if totalGold >= 25:
self.buildXY("decoy", x, y)
decoysBuilt = decoysBuilt + 1
self.say("Done building decoys!")
# Go to Naria and say how many decoys you built.
self.moveXY(14, 36)
self.say("J'ai construit 4 decoys")
would you be so kind to explain me the problem with my code ? it is not working after build the first decoy