Exemple #1
0
    def __init__(self):
        SceneBase.__init__(self)
        self.FONT = pygame.font.SysFont(FONT_FAMILY, int(FONT_SIZE / 2))
        self.FONT_2 = pygame.font.SysFont(FONT_FAMILY, FONT_SIZE)
        self.space_ship = SpaceShip(WIN_WIDTH / 2, WIN_HEIGHT / 2)
        self.start_time = datetime.datetime.now()
        self.space_ship_sprite = pygame.sprite.RenderPlain(self.space_ship)
        self.coins = 0

        self.time_text = self.FONT.render(str(self.start_time), False,
                                          pygame.Color(BLUE))
        self.best_coin = 0
        self.best_time_text = self.FONT.render(str(self.best_coin), False,
                                               pygame.Color(BLUE))
        self.coins_text = self.FONT.render('Coins: ' + str(self.coins), False,
                                           pygame.Color(BLUE))
        self.menu_button = pygame.Rect(WIN_WIDTH * 8.5 / 10,
                                       WIN_HEIGHT * 8.5 / 10, WIN_WIDTH / 10,
                                       WIN_HEIGHT / 10)
        self.menu_button_text = self.FONT.render('MENU', False,
                                                 pygame.Color(BLUE))

        self.pause_button = pygame.Rect(WIN_WIDTH * 7.5 / 10,
                                        WIN_HEIGHT * 8.5 / 10, WIN_WIDTH / 10,
                                        WIN_HEIGHT / 10)
        self.pause_button_text = self.FONT.render('PAUSE', False,
                                                  pygame.Color(WHITE))

        self.continue_button = pygame.Rect(WIN_WIDTH * 5.5 / 10,
                                           WIN_HEIGHT * 3 / 5, WIN_WIDTH / 5,
                                           WIN_HEIGHT / 10)
        self.menu_pause_button = pygame.Rect(WIN_WIDTH * 2.5 / 10,
                                             WIN_HEIGHT * 3 / 5, WIN_WIDTH / 5,
                                             WIN_HEIGHT / 10)
        self.continue_button_text = self.FONT_2.render('Continue', False,
                                                       pygame.Color(WHITE))
        self.menu_pause_button_text = self.FONT_2.render(
            'Menu', False, pygame.Color(WHITE))
        self.dead = False
        self.game_paused = False
        self.current_time = 0
        self.meteors_sprite = []
        self.meteors = []
        self.border_meteors = []
        self.border_meteors_sprite = []
        self.coin_obj = create_coin()
        self.coin_sprite = pygame.sprite.RenderPlain(self.coin_obj)
        self.previous_meteorite_time = 0
        self.best_coin_time = 0
        for i in range(0, WIN_WIDTH, 100):
            inaccuracy = randint(-50, 0)
            self.create_meteorite(i, inaccuracy, 0, 0, True)
            self.create_meteorite(i, WIN_HEIGHT - inaccuracy, 0, 0, True)

        for i in range(0, WIN_HEIGHT, 100):
            inaccuracy = randint(-50, 0)
            self.create_meteorite(inaccuracy, i, 0, 0, True)
            self.create_meteorite(WIN_WIDTH - inaccuracy, i, 0, 0, True)
Exemple #2
0
    def __init__(self):
        SceneBase.__init__(self)

        # init players
        gv.players.append(Player(gv.blue, K_LEFT, K_RIGHT))
        # gv.players.append(Player(gv.red, K_a, K_s))

        # init ItemHandler
        self.item_handler = ItemHandler()
Exemple #3
0
 def __init__(self):
     SceneBase.__init__(self)
     self.TITLE_FONT = pygame.font.SysFont(FONT_FAMILY, TITLE_FONT_SIZE)
     self.FONT = pygame.font.SysFont(FONT_FAMILY, FONT_SIZE)
     self.second_font = pygame.font.SysFont(FONT_FAMILY,
                                            int(FONT_SIZE * 2 / 4))
     self.back_button = pygame.Rect(WIN_WIDTH * 1 / 10, WIN_HEIGHT * 1 / 10,
                                    WIN_WIDTH / 5, WIN_HEIGHT / 10)
     self.back_text = self.FONT.render('back', False, pygame.Color(BLUE))
     self.best_players = read_data()
Exemple #4
0
 def __init__(self):
     SceneBase.__init__(self)
     self.TITLE_FONT = pygame.font.SysFont(FONT_FAMILY, TITLE_FONT_SIZE)
     self.FONT = pygame.font.SysFont(FONT_FAMILY, FONT_SIZE)
     self.play_button = pygame.Rect(WIN_WIDTH * 5.5 / 10,
                                    WIN_HEIGHT * 3 / 5, WIN_WIDTH / 5,
                                    WIN_HEIGHT / 10)
     self.high_button = pygame.Rect(WIN_WIDTH * 5.5 / 10,
                                    WIN_HEIGHT * 4 / 5, WIN_WIDTH / 5,
                                    WIN_HEIGHT / 10)
     self.text = self.TITLE_FONT.render('FLY...', False,
                                        pygame.Color(WHITE))
     self.play_text = self.FONT.render('PLAY', False, pygame.Color(WHITE))
     self.high_score_text = self.FONT.render('HIGH', False,
                                             pygame.Color(BLUE))
     self.space_ship = pygame.image.load('images/ships/spaceShips_007.png')
Exemple #5
0
 def __init__(self):
     SceneBase.__init__(self)
     self.FONT = pygame.font.SysFont(FONT_FAMILY, FONT_SIZE)
     self.play_button = pygame.Rect(WIN_WIDTH * 5.5 / 10,
                                    WIN_HEIGHT * 3 / 5, WIN_WIDTH / 5,
                                    WIN_HEIGHT / 10)
     self.back_button = pygame.Rect(WIN_WIDTH * 2.5 / 10,
                                    WIN_HEIGHT * 3 / 5, WIN_WIDTH / 5,
                                    WIN_HEIGHT / 10)
     self.play_text = self.FONT.render('PLAY', False, pygame.Color(WHITE))
     self.back_text = self.FONT.render('back', False, pygame.Color(BLUE))
     self.enter_name_text = self.FONT.render('Enter your name', False,
                                             pygame.Color(BLUE))
     self.name_input_form = InputBox(WIN_WIDTH * 2.5 / 10,
                                     WIN_HEIGHT * 2 / 5, WIN_WIDTH / 2,
                                     WIN_HEIGHT / 10)
     self.hint_text = self.FONT.render('', False, pygame.Color(RED))
     self.blank_from = True
Exemple #6
0
 def __init__(self):
     SceneBase.__init__(self)
     self.snake = Snake()
     self.prey = Prey()
Exemple #7
0
 def __init__(self):
     SceneBase.__init__(self)