Пример #1
0
    def on_mouse_press(self, x, y, button, modifiers):
        if self.window.objects.focus_object:
            focus = self.window.objects.focus_object
            focus_position = self.window.objects.objects[focus].position
        else:
            focus_position = self.position

        if button==RIGHT_BUTTON:
            vector =  Point(x,y) - (self.center - (self.position - focus_position))
            self.window.client.send_ball(vector)
            self.striking = vector
            return True
        else:
            Surface.on_mouse_press(self, x, y, button, modifiers)
Пример #2
0
    def on_mouse_press(self, x, y, button, modifiers):
        if self.window.objects.focus_object:
            focus = self.window.objects.focus_object
            focus_position = self.window.objects.objects[focus].position
        else:
            focus_position = self.position

        if button == RIGHT_BUTTON:
            vector = Point(x, y) - (self.center -
                                    (self.position - focus_position))
            self.window.client.send_ball(vector)
            self.striking = vector
            return True
        else:
            Surface.on_mouse_press(self, x, y, button, modifiers)
Пример #3
0
    def __init__(self, window, x,y,width, height):
        Surface.__init__(self, x,y,width, height)
        print width, height
        self.rad_h = self.height/2+1
        self.rad_w = self.width/2+1
        
        self.position = Point(0,0)
        self.prev_position = False
        
        self.window = window
        self.destination = False
        
        self.control_keys = [UP, DOWN, LEFT, RIGHT, RSHIFT, SPACE]
        self.vector = Point(0,0)
        self.striking = False

        
        self.step = TILESIZE/2
        self.vector = Point(0,0)
        self.vectors = {UP:Point(0,self.step), DOWN: Point(0,-self.step),
               LEFT : Point(-self.step,0), RIGHT : Point(self.step,0)}
Пример #4
0
    def __init__(self, window, x, y, width, height):
        Surface.__init__(self, x, y, width, height)
        print width, height
        self.rad_h = self.height / 2 + 1
        self.rad_w = self.width / 2 + 1

        self.position = Point(0, 0)
        self.prev_position = False

        self.window = window
        self.destination = False

        self.control_keys = [UP, DOWN, LEFT, RIGHT, RSHIFT, SPACE]
        self.vector = Point(0, 0)
        self.striking = False

        self.step = TILESIZE / 2
        self.vector = Point(0, 0)
        self.vectors = {
            UP: Point(0, self.step),
            DOWN: Point(0, -self.step),
            LEFT: Point(-self.step, 0),
            RIGHT: Point(self.step, 0)
        }
Пример #5
0
 def __init__(self, window, x, y, width, height):
     Surface.__init__(self, x, y, width, height)
     self.window = window
Пример #6
0
 def __init__(self, window, x,y,width, height):
     Surface.__init__(self, x,y,width, height)
     self.window = window