Example #1
0
    def collide_customed(self, widget):
        '''
        Function which implement custom collision between 2 widgets
        This function draw a square with center (self.center_x, self.center_y) and size = ( widget.size - self.size)/2 (1 if res <0)
        :param Widget: the widget to test collision with self
        :type widget = Widget, we will use center_x,center_y and size
        
        :return Return true is self's custom zone is in collision with widget
    '''
        #Calcul of radius
        size = ((widget.size_hint_x - self.size_hint_x) / 4)
        # if r <=0, the test will be done with a point
        if (size <= 0):
            size = 1
        #Creation of the zone
        zone = Widget()
        zone.center_x = widget.center_x
        zone.center_y = widget.center_y
        zone.size_hint_x = size
        zone.size_hint_y = size

        #Test the collision
        return (self.collide_widget(zone))
Example #2
0
 def collide_customed(self, widget):
     '''
     Fonction which implement custom collision between 2 widgets
     This function draw a square with center (self.center_x, self.center_y) and size = ( widget.size - self.size)/2 (1 if res <0)
     :param Widget: the widget to test collision with self
     :type widget = Widget, we will use center_x,center_y and size
     
     :return Return true is self's custom zone is in collision with widget
 '''
     #Calcul of radius
     size = ((widget.size_hint_x - self.size_hint_x)/4)
     # if r <=0, the test will be done with a point
     if (size<=0):
         size = 1
     #Creation of the zone
     zone = Widget()
     zone.center_x = widget.center_x
     zone.center_y = widget.center_y
     zone.size_hint_x = size
     zone.size_hint_y = size
     
     #Test the collision
     return(self.collide_widget(zone))