def main(): pygame.init() screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) pygame.display.set_caption(u'俄罗斯方块') pygame.key.set_repeat(100, 100) game_resource = GameResource() game_state = GameState(screen, game_resource) game_resource.play_bg_music() while True: if game_state.piece and game_state.piece.is_at_bottom: game_state.touch_bottom() if game_state.score >= game_state.difficulty * SCORE_PER_LEVEL: game_state.add_difficulty() check_events(game_state, game_resource) screen.blit(game_resource.load_bg_img(), (0, 0)) GameDisplay.draw_game_area(game_state, game_resource) if game_state.piece: GameDisplay.draw_piece(game_state) pygame.display.flip()