Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def on_on_overlap(sprite, otherSprite):
- global encounter, WordIndice, InsertLocation, response, question
- QuestionIndices: List[number] = []
- # WrongIndices: List[number] = []
- encounter = 1
- WordIndice = randint(0, len(WordList))
- InsertLocation = randint(0, 3)
- response = 5
- question=""
- # make list of wrong answers
- while len(QuestionIndices) < 3:
- indice = randint(0, len(WordList))
- if QuestionIndices.index(indice) < 0 and indice != WordIndice:
- QuestionIndices.append(indice)
- # add right answer at random location
- if InsertLocation != 3:
- QuestionIndices.insert_at(0, WordIndice)
- else:
- QuestionIndices.append(WordIndice)
- #game.show_long_text(len(QuestionIndices), DialogLayout.BOTTOM)
- #game.show_long_text(QuestionIndices, DialogLayout.BOTTOM)
- question = "Definition of " + WordList[indice][0] + " is:\n"+"1: "+WordList[QuestionIndices[0]][1]+"\n 2: "+WordList[QuestionIndices[1]][1]+"\n"
- """Checks user input"""
- while encounter == 1:
- game.show_long_text(question, DialogLayout.FULL)
- response = game.ask_for_number("answer (5 to show question again)")
- if response == 5:
- continue
- else:
- game.show_long_text("you answered!", DialogLayout.BOTTOM)
- encounter = 0
- P1.x += 40
- sprites.on_overlap(SpriteKind.player, SpriteKind.food, on_on_overlap)
Advertisement
Add Comment
Please, Sign In to add comment