def update_collisions(self):
        """
        Test player for collisions with items
        """
        if not self.mode['items'] or len(self.mode['items']) == 0: return

        # update collman
        # FIXME: Why update each frame?
        self.collman.clear()
        for z, node in self.children:
            if hasattr(node, 'cshape') and type(node.cshape) == cm.CircleShape:
                self.collman.add(node)

        # interactions player - others
        for other in self.collman.iter_colliding(self.player):
            typeball = other.btype
            self.logger.debug('collision', typeball)

            # TODO: Limit player position on non-removable items
            #if not other.removable:
            #    pass

            if other.removable:
                self.to_remove.append(other)

            self.reward_item(typeball)

        #
        #    elif (typeball == 'wall' or
        #          typeball == 'gate' and self.cnt_food > 0):
        #        self.level_losed()
        #
        #    elif typeball == 'gate':
        #        self.level_conquered()

        self.remove_items()
def update_collisions ( self ) : if not self . mode [ 'items' ] or len ( self . mode [ 'items' ] ) == 0 : return self . collman . clear ( ) for z , node in self . children : if hasattr ( node , 'cshape' ) and type ( node . cshape ) == cm . CircleShape : self . collman . add ( node ) for other in self . collman . iter_colliding ( self . player ) : typeball = other . btype self . logger . debug ( 'collision' , typeball ) if other . removable : self . to_remove . append ( other ) self . reward_item ( typeball ) self . remove_items ( )
Test player for collisions with items