def checkAnswer(qNum): answer = int(input("R: ")) if (answer == c.correctAnswer[qNum]): c.currentGamePoints += 5 return True else: ap.addPoints("Puntajes.txt", c.currentGamePoints) ap.graphScore("Puntajes.txt") bf.quitGame() return False
def hitDK(): if m.sqrt((c.mX - c.dkX)**2 + (c.mY - c.dkY)**2) < 50: ap.addPoints("Puntajes.txt", c.currentGamePoints) ap.graphScore("Puntajes.txt") bf.quitGame()
c.update() cc.update() if p.spritePosition.name == "H2J" and cc.spritePosition.name == "C00": cc.spritePosition.nextMove = cc.allPositions["C01"] # If the coconut reach the bottom : hide it if cc.spritePosition.name == "C03": cc.hide() # If monkey is jumping to the key if p.spritePosition.name == "H4J": if k.spritePosition.name == "K03": # Monkey grab the key p.spritePosition.nextMove = p.allPositions["H5T"] k.hide() sc.addPoints(random.randrange(5, 10)) cage.hide_cage(4 - cages) cages -= 1 if cages == 0: sc.addPoints(25) cage.show_smile() p.update() p.update() pause(1000) else: # Monkey miss the key m.update(missed) missed += 1 p.spritePosition.nextMove = p.allPositions["H7F"] # Monkey finish in the bush pause(300)