Example #1
0

class Human():
    def __init__(self, widget):
        self.widget = widget
        widget.on_touch_move = self.on_touch_move

    def on_touch_move(self, touch):
        if touch.x < self.widget.width / 3:
            self.widget.center_y = touch.y
        elif touch.x > self.widget.width - self.widget.width / 3:
            self.widget.center_y = touch.y

    def on_pong(self):
        pass


class PongApp(App):
    def build(self):
        game = PongGame()
        game.serve_ball()
        Clock.schedule_interval(game.update,
                                1.0 / float(Config.get('frame_limit')))
        return game


if __name__ == "__main__":
    Config.load()
    Window.fullscreen = 'auto'
    PongApp().run()