def talk_with_save(self, Save, surface): name = progress.get_progress('name') answer = engine.get_input((Save.lines['l1a'], (Save.lines['l1b'] + name)), Save.lines['l1q'], surface, 1) if answer == 'yes': engine.display_message((Save.lines['l2'],), surface) engine.wait() elif answer == 'change name': answer = engine.get_input((Save.lines['l3'],), ' ', surface, 2) progress.set_progress('name', answer)
def talk_with_bob(self, Bob, surface): status = progress.get_progress('bi_bob') name = progress.get_progress('name') if status == 0: answer = engine.get_input((Bob.lines['l1a'],), Bob.lines['l1q'], surface, 2) progress.set_progress('bi_library', 2) if answer == 'yes': answer = engine.get_input((Bob.lines['l2yes'],), Bob.lines['l2q'], surface, 2) progress.set_progress('name', answer) engine.display_message(((Bob.lines['l3a'] + cryptofunctions.encrypt(answer, 'bob')), Bob.lines['l3b']), surface) engine.wait() engine.get_input((Bob.lines['l4a'],), Bob.lines['l4q'], surface, 2) engine.display_message((Bob.lines['l5'],), surface) progress.set_progress('bi_bob', 1) else: engine.display_message((Bob.lines['l2no'],), surface) elif status == 1: engine.display_message((Bob.lines['l6'],), surface) engine.wait()
def talk_with_bartender(self, Bartender, Player, surface): for item in self.items: if item.ID == 'PICKLEJUICE': Picklejuice = item if item.ID == 'BEER': Beer = item if item.ID == 'WET_MARTINI': Wet_martini = item for item in Player.inventory: if item.ID == 'PICKLE': Pickle = item answer = engine.get_input((Bartender.lines['l1a'], Bartender.lines['l1b'], Bartender.lines['l0']), Bartender.lines['q1'], surface, 2) while not answer in ('bebiebir', 'pibicklebi jubiibicebi', 'webit mabirtibinibi', 'picklej'): answer = engine.get_input((Bartender.lines['l2c'], Bartender.lines['l1a'], Bartender.lines['l1b']), Bartender.lines['q1'], surface, 2) if answer == 'webit mabirtibinibi': engine.display_message((Bartender.lines['l2a'] + answer + Bartender.lines['l2b'], ), surface) Player.inventory.add(Wet_martini) elif answer == 'bebiebir': engine.display_message((Bartender.lines['l2a'] + answer + Bartender.lines['l2b'], ), surface) engine.wait() engine.display_message((Bartender.lines['l5a'], ), surface) Player.inventory.add(Beer) elif answer == 'pibicklebi jubiibicebi' or answer == 'picklej': status = progress.get_progress('bi_pickle') if status == 0 or status == 1: engine.display_message((Bartender.lines['l3a'], ), surface) progress.set_progress('bi_pickle', 1) elif status == 2: engine.display_message((Bartender.lines['l4a'], ), surface) engine.wait() engine.display_message((Bartender.lines['l4b'], ), surface) Player.inventory.remove(Pickle) Player.inventory.add(Picklejuice) progress.set_progress('bi_pickle', 0) elif answer == 'esc': pass engine.wait()
def updateGroups(): if progress.get_progress('bi_library') == 2: library_group.add(Book_bob) library_collide.add(Book_bob) Library = library.Library('pictures/library_bg.png', library_group, library_collide)
def mainloop(self, surface, event): for sprite in self.sprites: # pull sprites from sprite group to make it easier if sprite.ID == 'PLAYER': Player = sprite elif sprite.ID == 'DOOR': Door = sprite elif sprite.ID == 'DOOR_BAR': Door_bar = sprite elif sprite.ID == 'DOOR_BOB': Door_bob = sprite elif sprite.ID == 'DOOR_PPSHED': Door_pickleshed = sprite elif sprite.ID == 'DOOR_LIB': Door_library = sprite elif sprite.ID == 'PICKLEPLANT': Pickle_plant = sprite for item in self.items: if item.ID == 'PICKLE': Pickle = item surface.blit(self.image, (1, 1)) self.sprites.draw(surface) new_room = 'bitown' from_room = 'bitown' if event.type == KEYDOWN: if event.key == K_RETURN: if engine.check_bordering(Player, Door): tmp = self.exit('house1') from_room = tmp[0] new_room = tmp[1] elif engine.check_bordering(Player, Door_bar): tmp = self.exit('bar') from_room = tmp[0] new_room = tmp[1] elif engine.check_bordering(Player, Door_bob): tmp = self.exit('house_bob') from_room = tmp[0] new_room = tmp[1] elif engine.check_bordering(Player, Door_pickleshed): tmp = self.exit('pickleshed') from_room = tmp[0] new_room = tmp[1] elif engine.check_bordering(Player, Door_library): tmp = self.exit('library') from_room = tmp[0] new_room = tmp[1] elif engine.check_bordering(Player, Pickle_plant): status = progress.get_progress('bi_pickle') #if not Pickle in Player.inventory: if status == 0: ans = '' while ans not in ('yes', 'no'): ans = engine.get_input( (Pickle_plant.lines['unpicked'], ), Pickle_plant.lines['q1'], surface) if ans == 'yes': progress.set_progress('bi_pickle', 2) Player.add_to_inventory((Pickle, )) Pickle_plant.picked = 1 Pickle_plant.change_picture(2) engine.display_message( (Pickle_plant.lines['unpicked2'], ), surface) engine.wait() else: engine.display_message( (Pickle_plant.lines['picked'], ), surface) engine.wait() elif event.key in (K_d, K_s, K_a, K_w): Player.move(event.key, self.collide_group) return (from_room, new_room)