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


Python HelperFunctions.appendHighScore方法代碼示例

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


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

示例1: main

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

#.........這裏部分代碼省略.........
                                playerName = playerName[:-1]
                                showUpdates = True
                            elif keypress.key == pygame.K_RETURN:

                                getInput = False
                                continue

                    if showUpdates:

                        screen.fill((0, 0, 0))
                        text = ourFont.render(playerName, True, (255,
                                0, 0))
                        block = text.get_rect()
                        block.center = (400, 300)  # dead center
                        rect_list.append(screen.blit(text, block))

                        text = \
                            ourFont.render('Please type your name, press enter to finish, and backspace to remove characters. '
                                , True, (255, 255, 255))
                        block = text.get_rect()
                        block.center = (400, 250)

                  # block.center[1] -= 100

                        rect_list.append(screen.blit(text, block))

                        pygame.display.update(rect_list)
                        showUpdates = False

            # end while

                print 'Final name', playerName

                HelperFunctions.appendHighScore(playerScore, playerName)

                state = STATE_HIGH_SCORE_TRY_AGAIN

            elif state == STATE_LEVEL_CREATOR:
                screen.fill((0, 0, 0))

                rect_list.append(HelperFunctions.makeTextRect(
                    'Please follow the instructions in the console.',
                    (255, 255, 255),
                    (400, 250),
                    screen,
                    ourFont,
                    True,
                    ))

                rect_list.append(HelperFunctions.makeTextRect(
                    'Once complete, please restart the menu. ',
                    (255, 255, 255),
                    (400, 300),
                    screen,
                    ourFont,
                    True,
                    ))

                pygame.display.update(rect_list)

                os.system(sys.executable + ' level_creator.py')

                state = STATE_EXIT
            elif state == STATE_HIGH_SCORES:

                # print 'High Scores'
開發者ID:jamietanna,項目名稱:PySnake,代碼行數:70,代碼來源:PySnakeMenu.py


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