def enter(self, enter_params=None): # Get needed settings self.window_width = Settings.instance().settings['window_width'] self.window_height = Settings.instance().settings['window_height'] # Load fonts load_font('fonts\\font.ttf', 'medium', self.cached_fonts, 48) load_font('fonts\\font.ttf', 'title', self.cached_fonts, 256) # Load sounds load_sound('sounds\\enter_menu_item.wav', 'enter_menu_item', self.cached_sounds) # Play music play_music(0, self.music) self.menu_items = { '1_player': MenuItem((self.window_width * 2 // 5, self.window_height * 4 // 8), '>> 1 Player', self.cached_fonts['medium']), '2_players': MenuItem((self.window_width * 2 // 5, self.window_height * 5 // 8), '>> 2 Players', self.cached_fonts['medium']), 'demo': MenuItem((self.window_width * 2 // 5, self.window_height * 6 // 8), '>> Demo', self.cached_fonts['medium']), 'exit': MenuItem((self.window_width * 2 // 5, self.window_height * 7 // 8), '>> Exit', self.cached_fonts['medium']) }
def _load_fonts(self): """Load the fonts.""" logging.info('Loading fonts') self.fonts = { 'normal': helpers.load_font('coolvetica.ttf', 18), 'big': helpers.load_font('coolvetica.ttf', 30) }
def _load_fonts(self): """Load the fonts.""" logging.info('Loading fonts') self.fonts = { 'info_panel': helpers.load_font('coolvetica.ttf', 26), 'nearby_mines_count': helpers.load_font('coolvetica.ttf', 16), 'normal': helpers.load_font('coolvetica.ttf', 18), 'title': helpers.load_font('coolvetica.ttf', 30) }
def _load_fonts(self): """Load the fonts.""" logging.info('Loading fonts') self.fonts = { 'normal': helpers.load_font('celtic_gaelige.ttf', 21) }
def enter(self, enter_params=None): # Get needed settings self.window_width = Settings.instance().settings['window_width'] self.window_height = Settings.instance().settings['window_height'] self.win_score = Settings.instance().settings['win_score'] # Save enter parameters self.num_players = enter_params['num_players'] self.input_device = enter_params['input_device'] self.difficulty = enter_params.get('difficulty') # Load font load_font('fonts\\font.ttf', 'small_medium', self.cached_fonts, 32) load_font('fonts\\font.ttf', 'medium', self.cached_fonts, 48) load_sound('sounds\\enter_menu_item.wav', 'enter_menu_item', self.cached_sounds) self.menu_items = { 'back': MenuItem((self.window_width // 20, self.window_height * 14 // 15), '< Back', self.cached_fonts['medium']) }
def enter(self, enter_parmas): # Get needed settings self.window_width = Settings.instance().settings['window_width'] self.window_height = Settings.instance().settings['window_height'] # Save enter parameters self.num_players = enter_parmas['num_players'] # Load fonts load_font('fonts\\font.ttf', 'medium', self.cached_fonts, 48) load_font('fonts\\font.ttf', 'large', self.cached_fonts, 64) # Load sounds load_sound('sounds\\enter_menu_item.wav', 'enter_menu_item', self.cached_sounds) self.menu_items = { 'mouse': MenuItem((self.window_width * 2 // 5, self.window_height * 5 // 8), '>> Mouse', self.cached_fonts['medium']), 'keyboard': MenuItem((self.window_width * 2 // 5, self.window_height * 6 // 8), '>> Keyboard', self.cached_fonts['medium']), 'back': MenuItem((self.window_width // 20, self.window_height * 14 // 15), '< Back', self.cached_fonts['medium']) }
def enter(self, enter_parmas): # Get needed settings self.window_width = Settings.instance().settings['window_width'] self.window_height = Settings.instance().settings['window_height'] # Save enter parameters self.num_players = enter_parmas['num_players'] self.input_device = enter_parmas['input_device'] # Load fonts load_font('fonts\\font.ttf', 'medium', self.cached_fonts, 48) load_font('fonts\\font.ttf', 'large', self.cached_fonts, 64) # Load sounds load_sound('sounds\\enter_menu_item.wav', 'enter_menu_item', self.cached_sounds) self.menu_items = { 'beginner': MenuItem((self.window_width * 2 // 5, self.window_height * 3 // 8), '>> Beginner', self.cached_fonts['medium']), 'intermediate': MenuItem((self.window_width * 2 // 5, self.window_height * 4 // 8), '>> Intermediate', self.cached_fonts['medium']), 'expert': MenuItem((self.window_width * 2 // 5, self.window_height * 5 // 8), '>> Expert', self.cached_fonts['medium']), 'back': MenuItem((self.window_width // 20, self.window_height * 14 // 15), '< Back', self.cached_fonts['medium']), }
def enter(self, enter_params=None): # Get needed settings self.window_width = Settings.instance().settings['window_width'] self.window_height = Settings.instance().settings['window_height'] # Load fonts load_font('fonts\\font.ttf', 'medium', self.cached_fonts, 48) load_font('fonts\\font.ttf', 'title', self.cached_fonts, 256) # Load sounds load_sound('sounds\\enter_menu_item.wav', 'enter_menu_item', self.cached_sounds) self.menu_items = { 'resume': MenuItem((self.window_width // 3, self.window_height * 5 // 8), '>> Resume Game', self.cached_fonts['medium']), 'new_game': MenuItem((self.window_width // 3, self.window_height * 6 // 8), '>> New Game', self.cached_fonts['medium']), 'exit': MenuItem((self.window_width // 3, self.window_height * 7 // 8), '>> Exit', self.cached_fonts['medium']) }
def enter(self, enter_params=None): self.window_width = Settings.instance().settings['window_width'] self.window_height = Settings.instance().settings['window_height'] self.far_scroll_speed = Settings.instance( ).settings['far_scroll_speed'] self.close_scroll_speed = Settings.instance( ).settings['close_scroll_speed'] self.pipe_horizontal_gap = Settings.instance( ).settings['pipe_horizontal_gap'] self.pipe_min_height = Settings.instance().settings['pipe_min_height'] self.pipe_max_height = Settings.instance().settings['pipe_max_height'] self.pipe_gap_min = Settings.instance().settings['pipe_gap_min'] self.pipe_gap_max = Settings.instance().settings['pipe_gap_max'] # Load fonts load_font(os.path.join('fonts', 'super_retro.ttf'), 'retro_70', self.cached_fonts, 70) load_font(os.path.join('fonts', 'super_retro.ttf'), 'retro_40', self.cached_fonts, 40) load_font(os.path.join('fonts', 'super_retro.ttf'), 'retro_20', self.cached_fonts, 20) load_font(os.path.join('fonts', 'super_retro.ttf'), 'retro_10', self.cached_fonts, 10) # Load background images self.background_top = ScrollingBackground( os.path.join('images', 'background_top_tile.png'), 0, 5, self.far_scroll_speed, self.window_width) self.background_bottom = ScrollingBackground( os.path.join('images', 'background_bottom_tile.png'), 0, 5, self.close_scroll_speed, self.window_width) self.background_bottom.y = self.window_height - \ self.background_bottom.tile_image.get_height() # Load score menu self.end_game_menu = EndGameMenu(self.window_width // 2, self.window_height // 3, self.cached_fonts) self.end_game_menu.set_on_restart_callback(self.new_game) # Load bird self.bird = Bird(self.window_width // 2, self.window_height // 2) self.new_game()
def enter(self, enter_params): # Get needed settings self.window_width = Settings.instance().settings['window_width'] self.window_height = Settings.instance().settings['window_height'] # Save enter parameters self.winner = enter_params['winner'] self.player1_score = enter_params['player1_score'] self.player2_score = enter_params['player2_score'] # Load fonts load_font('fonts\\font.ttf', 'small', self.cached_fonts, 24) load_font('fonts\\font.ttf', 'large', self.cached_fonts, 64) load_font('fonts\\font.ttf', 'huge', self.cached_fonts, 128)
def enter(self, enter_params=None): # Get needed settings self.window_width = Settings.instance().settings['window_width'] self.window_height = Settings.instance().settings['window_height'] self.paddle_width = Settings.instance().settings['paddle_width'] self.paddle_height = Settings.instance().settings['paddle_height'] self.paddle_tolerance_beginner = Settings.instance( ).settings['paddle_tolerance_beginner'] self.paddle_tolerance_Intermediate = Settings.instance( ).settings['paddle_tolerance_Intermediate'] self.paddle_tolerance_expert = Settings.instance( ).settings['paddle_tolerance_expert'] self.ball_speed_increase_beginner = Settings.instance( ).settings['ball_speed_increase_beginner'] self.ball_speed_increase_intermediate = Settings.instance( ).settings['ball_speed_increase_intermediate'] self.ball_speed_increase_expert = Settings.instance( ).settings['ball_speed_increase_expert'] self.paddle_special_hit_threshold = Settings.instance( ).settings['paddle_special_hit_threshold'] self.paddle_special_hit_increase = Settings.instance( ).settings['paddle_special_hit_increase'] self.net_segments = Settings.instance().settings['net_segments'] self.net_segments_gap = Settings.instance( ).settings['net_segments_gap'] self.net_segments_height = Settings.instance( ).settings['net_segments_height'] self.net_segment_width = Settings.instance( ).settings['net_segment_width'] self.win_score = Settings.instance().settings['win_score'] # Save enter parameters self.num_players = enter_params.get('num_players') self.input_device = enter_params.get('input_device') self.difficulty = enter_params.get('difficulty') self.is_demo = enter_params.get('is_demo') if self.is_demo is None: self.is_demo = False # Load Fonts load_font('fonts\\font.ttf', 'small_medium', self.cached_fonts, 32) load_font('fonts\\font.ttf', 'huge', self.cached_fonts, 128) # Load Sounds load_sound('sounds\\paddle_hit.wav', 'paddle_hit', self.cached_sounds) load_sound('sounds\\score.wav', 'score', self.cached_sounds) load_sound('sounds\\wall_hit.wav', 'wall_hit', self.cached_sounds) load_sound('sounds\\paddle_special_hit.wav', 'paddle_special_hit', self.cached_sounds) # Play music play_music(1, self.music) # Create Entites self.ball = Ball(self.window_width // 2, self.window_height // 2, Settings.instance().settings['ball_radius']) self.player1 = Paddle(self.paddle_width // 2, self.paddle_height // 2 + 100, self.paddle_width, self.paddle_height) self.player2 = Paddle( self.window_width - self.paddle_width // 2, self.window_height - self.paddle_height // 2 - 100, self.paddle_width, self.paddle_height) self.ball.set_initial_speed(self.serving_player == 2) # Set tolerance according to difficulty tolerance = random.randint(self.paddle_tolerance_beginner[0], self.paddle_tolerance_beginner[1]) / 100 self.speed_increase = self.ball_speed_increase_beginner if self.difficulty == 'intermediate': tolerance = random.randint( self.paddle_tolerance_Intermediate[0], self.paddle_tolerance_Intermediate[1]) / 100 self.speed_increase = self.ball_speed_increase_intermediate if self.difficulty == 'expert': tolerance = random.randint(self.paddle_tolerance_expert[0], self.paddle_tolerance_expert[1]) / 100 self.speed_increase = self.ball_speed_increase_expert self.player2.set_tolerance(tolerance) # Load particle system self.particle_system = ParticleSystem( self.ball.get_position()[0], self.ball.get_position()[1], ParticleShape.SQUARE, Settings.instance().settings['particle_size'], Settings.instance().settings['particle_birth_rate'], Settings.instance().settings['particle_speed'], Settings.instance().settings['particle_death_age']) gradient = Gradient( Settings.instance().settings['particle_gradient_color_01'], Settings.instance().settings['particle_gradient_last_color']) gradient.add_color( Settings.instance().settings['particle_gradient_color_02'], Settings.instance().settings['particle_gradient_color_02_pos']) gradient.add_color( Settings.instance().settings['particle_gradient_color_03'], Settings.instance().settings['particle_gradient_color_03_pos']) gradient.add_color( Settings.instance().settings['particle_gradient_color_04'], Settings.instance().settings['particle_gradient_color_04_pos']) self.particle_system.set_gradient(gradient) self.particle_system.set_death_variance( Settings.instance().settings['particle_death_variant']) self.particle_system.set_speed_variance( Settings.instance().settings['particle_speed_variant'])