コード例 #1
0
ファイル: menu.py プロジェクト: egeyosunkaya/floppy-birdie
    def __init__(self, start_game_callback, quit_game_callback):
        self.menu = pygame_menu.Menu(int(GlobalVars.get_screen_size().x * 0.6),
                                     int(GlobalVars.get_screen_size().y * 0.6),
                                     'Floppy Birdie',
                                     theme=pygame_menu.themes.THEME_BLUE)

        self.menu.add_button("Start", start_game_callback)
        self.menu.add_button("Quit", quit_game_callback)
コード例 #2
0
    def check_collision(self):

        # Pipe - Bird Collision
        for pipe_tuple in self.background_state.pipe_list:
            for pipe in pipe_tuple:
                if pipe.get_collision_box().colliderect(
                        self.bird_state.get_collision_box()):
                    print("Collision detected")
                    return True

        # Bird Out of bounds check
        out_of_bounds_pixel_tolerance = 10
        bird_coll_box = self.bird_state.get_collision_box()
        if bird_coll_box.bottom > GlobalVars.get_screen_size().y + out_of_bounds_pixel_tolerance \
            or bird_coll_box.top < 0 - out_of_bounds_pixel_tolerance:
            print("Out of bounds deteced")
            return True

        return False
コード例 #3
0
 def __init__(self):
     self.sprite = pygame.transform.scale(pygame.image.load("assets/background.jpg"),
         (int(GlobalVars.get_screen_size().x), int(GlobalVars.get_screen_size().y)),
      )
     self.location = Vector2(0,0)
     self.texture_rect = Rect(0, 0, 768, 512)