コード例 #1
0
 def start_game(self):
     self.was_colliding = False
     self.pipes = []
     self.root.ids.score.text = "0"
     self.frames = Clock.schedule_interval(self.next_frame, 1/60.)
     #create pipes
     number_of_pipes = 5
     distance_between_the_pipes = Window.width / 3
     for i in range(number_of_pipes):
         pipe = Pipe()
         pipe.pipe_center = randint(119 + 100, self.root.height - 100)
         pipe.size_hint = (None, None)
         pipe.pos = (Window.width + i*distance_between_the_pipes, 119)
         pipe.size = (66, self.root.height - 119)
         self.pipes.append(pipe)
         self.root.add_widget(pipe)
コード例 #2
0
ファイル: Main.py プロジェクト: GuthyX/PythonBeadando
    def start_game(self):
        self.root.ids.score.text = "0"
        self.was_colliding = False
        self.pipes = []
        self.frames = Clock.schedule_interval(self.next_frame, 1/60.)

        # Pipeok létrehozása
        num_pipes = 5
        distance_between_pipes = Window.width / (num_pipes - 1)
        for i in range(num_pipes):
            pipe = Pipe()
            pipe.pipe_center = randint(96 + 100, self.root.height - 100)
            pipe.size_hint = (None, None)
            pipe.pos = (Window.width + i*distance_between_pipes, 96)
            pipe.size = (64, self.root.height - 96)

            self.pipes.append(pipe)
            self.root.add_widget(pipe)
コード例 #3
0
    def start_game(self):
        #create pipes
        num_pipes = 5
        pipes_gap = Window.width / (num_pipes - 1)
        for i in range(num_pipes):
            pipe = Pipe()
            #                          (Base Height + Body Height + Cap height + 30, root Height - Body Height - Cap height - 30)
            pipe.pipe_center = randint(100 + 20 + 20 + 30,
                                       self.root.height - 20 - 20 - 30)
            pipe.size_hint = (None, None)
            pipe.pos = (pipes_gap * i, 100)
            #           (Cap width, root height - base height)
            pipe.size = (66, self.root.height - 100)

            self.pipes.append(pipe)
            self.root.add_widget(pipe)

        #move pipes

        Clock.schedule_interval(self.move_pipes, 1 / 60.)
コード例 #4
0
 def start_game(self):
     self.was_colliding = False
     self.root.ids.score.text = "0"
     self.pipes = []
     # Game Loop
     self.frames = Clock.schedule_interval(self.next_frame, FRAME_RATE)
     # Create the pipes
     # 5 Pipes per screen
     num_pipes = 5
     # create the distance between the pipes
     distance_between_pipes = Window.width / (num_pipes - 1)
     # create the Pipes
     for i in range(num_pipes):
         pipe = Pipe()
         # set the pipe centre positioning randomly
         pipe.pipe_centre = random.randint(96 + 100, self.root.height - 100)
         pipe.size_hint = (None, None)
         # spawn pipe off screen plus the offset distance between the pipes
         pipe.pos = (Window.width + (i * distance_between_pipes), 96)
         pipe.size = (64, self.root.height - 96)
         
         self.pipes.append(pipe)
         self.root.add_widget(pipe)