Example #1
0
 def collide_player_free(self, a, b, contacts, normal_coef, data):
     return_val = True
     self.collided_last.append(b)
     if (self.keys[key.LSHIFT] or b.parent.auto_attach) and b.parent.gluebody.attachable and b == b.parent.circle:
         a.parent.gluebody.acquire_singlebody(b.parent.gluebody, a.parent)
         if b.parent.ask_key or (
             b.parent.__class__.__name__ not in event.instructions_seen and b.parent.instruction_image != None
         ):
             if self.mode == CHOOSE_KEY:
                 return True
             self.mode = CHOOSE_KEY
             keychooser.screenshot = pyglet.image.get_buffer_manager().get_color_buffer().get_texture()
             if b.parent.ask_key:
                 keychooser.unit_to_bind = b.parent
                 gui.current_card = gui.Card(keychooser.widgets(b.parent.instruction_image))
             else:
                 gui.current_card = gui.Card(keychooser.instr_widgets(b.parent.instruction_image))
                 event.instructions_seen.append(b.parent.__class__.__name__)
             gui.next_card = None
             gui.last_card = RETURN_FROM_CHOOSE
             gui.transition_time = 0
             gui.push_handlers()
             for u in physics.unit_update_list:
                 if u.uses_keys:
                     u.deactivate()
         sound.play(resources.big_metal_clank2)
     else:
         self.play_metal_collision(a, b)
         if hasattr(b, "obj_id"):
             if b.obj_id in event.collision_funcs.keys():
                 for func in event.collision_funcs[b.obj_id]:
                     result = func()
                     if result == False:
                         return_val = False
     return return_val
Example #2
0
 def add():
     keychooser.unit_to_bind = unit
     gui.change_to_card_fast(gui.Card(keychooser.widgets()))