If the type is "poison", continue out of the loop. # Use an if-statement to check the item's type. # If there is an enemy, but no item, ask for a potion and continue out of the loop. Item = self.findNearest(self.findItems()) Hi welcome to the CodeCombat discourse.I presume you’re being killed by the lightning I can’t actually test it unfortunately because when I try to change the programming language it automatically reloads the level. # If there is no enemy, continue out of the loop.Įnemy = self.findNearest(self.findEnemies()) # Use "continue" to verify the conditions of the ambush. # However, unlike with "break", the loop repeats instead of stopping. Command the peasants to battle and the peons to go away while True: friend hero.findNearestFriend() enemy hero. Here is my code: Peasants and peons are gathering in the forest. # When the program uses the continue statement, the rest of the loop is skipped. In the level Friend and Foe in the Backwoods Forest, I am having trouble figuring out the correct way to complete the level. Pick up all appearing items EXCEPT gems.','','while True:',' item hero.findNearestItem()',' item hero. # The continue statement is powerful for managing complicated logic. Watch for flags that may appear signaling certain events.','','while True:',' if hero. The problem is my hero moves to late after the water is thrown and the ogre gets it and kills me there are other times where poison is thrown and the ogre drinks it but then water is thrown and poison a few seconds later and my hero drinks the water with the poison and then dies # Race munchkins to the water distilled by Omarn Brewstone!
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |