當前位置: 首頁>>代碼示例>>Python>>正文


Python HelperFunctions.isNewHighScore方法代碼示例

本文整理匯總了Python中HelperFunctions.isNewHighScore方法的典型用法代碼示例。如果您正苦於以下問題:Python HelperFunctions.isNewHighScore方法的具體用法?Python HelperFunctions.isNewHighScore怎麽用?Python HelperFunctions.isNewHighScore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HelperFunctions的用法示例。


在下文中一共展示了HelperFunctions.isNewHighScore方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: import HelperFunctions [as 別名]
# 或者: from HelperFunctions import isNewHighScore [as 別名]

#.........這裏部分代碼省略.........

                Config.PAGE_TITLE = Config.PAGE_TITLE + ' ' \
                    + level_files[state % 9000 - 1]['settings'
                        ]['level_name']

               # work out the bonus based on difficulty - will only work for valid difficulties
               # try:

                exec 'Config.DIFFICULTY_BONUS = Config.DIFFICULTY_BONUS_' \
                    + Config.DIFFICULTY.upper()

                Config.BACKGROUND = pygame.Surface(screen.get_size())
                Config.BACKGROUND = Config.BACKGROUND.convert()
                Config.BACKGROUND.fill(Config.BACKGROUND_COLOUR)
                Config.screen = \
                    pygame.display.set_mode(Config.DEFAULT_SCREEN_SIZE)

            # print "COLOUR: ", Config.BACKGROUND_COLOUR

            # better way of doing it?
            # execfile('Snake.py')

                G = Game_Module.Game(None)

                running = True
                while running:
                    G.update()
                    if G.gameOver:
                        playerScore = G.gameScore
                        del G
                        running = False
                        break

                if HelperFunctions.isNewHighScore(playerScore):
                    state = STATE_HIGH_SCORE_INPUT
                else:
                    # state = STATE_EXIT
                    state = STATE_HIGH_SCORE_TRY_AGAIN

            elif state == STATE_HIGH_SCORE_INPUT:

               # state = STATE_HIGH_SCORE_TRY_AGAIN

            # #### http://www.facebook.com/l.php?u=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F14111381%2Fhow-to-make-pygame-print-input-from-user&h=kAQHS8xjR

                (rect_list, state) = high_score_input_menu.update(e,
                        state)

                if False:
                    pass

                getInput = True
                showUpdates = True

                while getInput:
                    for keypress in pygame.event.get():
                        if keypress.type == pygame.KEYDOWN:
                            if keypress.unicode.isalpha():
                                playerName += keypress.unicode
                                showUpdates = True
                            elif keypress.key == pygame.K_BACKSPACE:

                                playerName = playerName[:-1]
                                showUpdates = True
                            elif keypress.key == pygame.K_RETURN:
開發者ID:jamietanna,項目名稱:PySnake,代碼行數:69,代碼來源:PySnakeMenu.py


注:本文中的HelperFunctions.isNewHighScore方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。