For some reason, when I make an “if self.now = 16:”, my hero goes and does the things inside that “if” statement before it is really 16 seconds.
Also, do you have to finish the code for the code to really work correctly?
For help, I will show you my code. I would really appreciate the help.
# Fight enemies for 15 seconds. # Keep count whenever an enemy is defeated. enemiesDead = 0 coinsCollected = 0 while self.now < 16: enemy = self.findNearest(self.findEnemies()) if enemy: while enemy.health > 0: self.attack(enemy) enemiesDead = enemiesDead + 1 else: self.moveXY(54, 33) # Tell Naria how many enemies you defeated. elif self.now = 16: self.moveXY(59, 33) self.say(enemiesDead) # Collect coins until the clock reaches 30 seconds. while self.now < 31 & self.now > 16: coin = self.findNearest(self.findItems()) if coin: pos = coin.pos x = coin.pos.x y = coin.pos.y self.moveXY(x, y) # Tell Naria how much gold you collected. # Fight enemies until the clock reaches 45 seconds. # Remember to reset the count of defeated enemies! # Tell Naria how many enemies you defeated.
P.S. : I am not finished with the code yet, I am just solving this problem right now.