当前位置: 首页>>代码示例>>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;未经允许,请勿转载。