ForsythsGambit

MakeCode Arcade SAT Run

Jan 10th, 2023 (edited)
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.43 KB | None | 0 0
  1. def on_on_overlap(sprite, otherSprite):
  2.     global encounter, WordIndice, InsertLocation, response, question
  3.     QuestionIndices: List[number] = []
  4.     # WrongIndices: List[number] = []
  5.     encounter = 1
  6.     WordIndice = randint(0, len(WordList))
  7.     InsertLocation = randint(0, 3)
  8.     response = 5
  9.     question=""
  10.     # make list of wrong answers
  11.     while len(QuestionIndices) < 3:
  12.         indice = randint(0, len(WordList))
  13.         if QuestionIndices.index(indice) < 0 and indice != WordIndice:
  14.             QuestionIndices.append(indice)
  15.     # add right answer at random location
  16.     if InsertLocation != 3:
  17.         QuestionIndices.insert_at(0, WordIndice)
  18.     else:
  19.         QuestionIndices.append(WordIndice)
  20.  
  21.     #game.show_long_text(len(QuestionIndices), DialogLayout.BOTTOM)
  22.     #game.show_long_text(QuestionIndices, DialogLayout.BOTTOM)
  23.     question = "Definition of " + WordList[indice][0] + " is:\n"+"1: "+WordList[QuestionIndices[0]][1]+"\n 2: "+WordList[QuestionIndices[1]][1]+"\n"
  24.  
  25.     """Checks user input"""
  26.     while encounter == 1:
  27.         game.show_long_text(question, DialogLayout.FULL)
  28.         response = game.ask_for_number("answer (5 to show question again)")
  29.         if response == 5:
  30.             continue
  31.         else:
  32.             game.show_long_text("you answered!", DialogLayout.BOTTOM)
  33.             encounter = 0
  34.             P1.x += 40
  35. sprites.on_overlap(SpriteKind.player, SpriteKind.food, on_on_overlap)
Advertisement
Add Comment
Please, Sign In to add comment