This recipe is for asking the user a multiple choice question. It should typically only be used with Maze, Path Adventure, and Room Adventure. BASIC QUESTION FUNCTION: Add the following function to the class you will use to ask questions. It will ask the user the question, wait for the user to type in their question, and then return whether the user's answer was correct (True or False). def ask_multiple_choice_question(self,question,choices,correct_answer): # pass in the question as a string, the choices as a list of strings, and # the correct answer as "a" or "b" or "c", etc depending on which item in the choices list is correct correct_answer = correct_answer[0] answered_correctly = False activity_completed = False while not activity_completed: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() elif event.type == pygame.KEYDOWN and event.key >= ord('a') and event.key <= ord('a')+len(choices)-1: # the user has answered activity_completed = True if event.key == ord(correct_answer): answered_correctly = True # Draw everything to the screen self.screen.blit(self.background, (0, 0)) font = pygame.font.Font(None, 30) text = font.render(question, 1, (0,0,0)) textrect = text.get_rect() textrect.centerx = self.area.centerx textrect.top = 300 self.screen.blit(text, textrect) letter = 'a' choices_top = 350 for choice in choices: font = pygame.font.Font(None, 30) text = font.render(letter + ") " + choice, 1, (0,0,0)) textrect = text.get_rect() textrect.left = 200 textrect.top = choices_top self.screen.blit(text, textrect) letter = chr(ord(letter) + 1) choices_top += 30 pygame.display.flip() self.activity_count += 1 if answered_correctly: self.correct_answer_count += 1 return answered_correctly Change the text drawing to customize it for your game. Note: If you are using the PracticeDrill template, you can use this for your play() function. Add the following lines before 'return answered_correctly'. self.activity_count += 1 if answered_correctly: self.correct_answer_count += 1 CALL THE FUNCTION: The following is an example of how you could call the function: question = "Which is the dog?" answer_choices = ["dog","cat","mouse","horse"] correct_answer = "a" if self.ask_multiple_choice_question(question,answer_choices,correct_answer): print "Correct!" else: print "Incorrect!" MAZE-SPECIFIC INSTRUCTIONS: The two times I can imagine a question being asked is when the player is touching a monster or is in a dead end. In both cases, add the ask_multiple_choice_question function from the recipe to the Player class in MazeGameSprites.py. To ask a question when the player runs into a monster, first use the monster touches cookbook recipe: http://itgirl.dreamhosters.com/itgirlgames/cookbook/maze/monster-touches.txt. Replace ¡Ègame_over = True¡É with the following code to ask the question (taken from the multiple choice question recipe, but self is changed to player). question = "Which is the dog?" answer_choices = ["dog","cat","mouse","horse"] correct_answer = "a" if player.ask_multiple_choice_question(question,answer_choices,correct_answer): print "Correct!" else: print "Incorrect!" To ask a question when the player runs into a dead end, first use the check dead end cookbook recipe: http://itgirl.dreamhosters.com/itgirlgames/cookbook/maze/check-dead-end.txt. Replace ¡Ègame_over = True¡É with the following code to ask the question (taken from the multiple choice question recipe, but self is changed to player). question = "Which is the dog?" answer_choices = ["dog","cat","mouse","horse"] correct_answer = "a" if player.ask_multiple_choice_question(question,answer_choices,correct_answer): print "Correct!" else: print "Incorrect!" PATH OR ROOM ADVENTURE INSTRUCTIONS: Add the ask_multiple_choice_question function from the recipe to ActivityBase class in ActivityBase.py. This way, every Activity class in Activities.py will be able to ask a question. In Activities.py, you will replace most of the code in the play function for the Activity class you want to ask the question to use the code from the recipe: question = "Which is the dog?" answer_choices = ["dog","cat","mouse","horse"] correct_answer = "a" if self.ask_multiple_choice_question(question,answer_choices,correct_answer): print "Correct!" else: print "Incorrect!" A play function that asks the player the question until they get it right looks like this: def play(self): correct_answer = False while not correct_answer: question = "Which is the dog?" answer_choices = ["dog","cat","mouse","horse"] correct_answer = "a" if self.ask_multiple_choice_question(question,answer_choices,correct_answer): correct_answer = True else: correct_answer = False