当前位置: 首页>>代码示例>>Python>>正文


Python Menu.level_select方法代码示例

本文整理汇总了Python中Menu.Menu.level_select方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.level_select方法的具体用法?Python Menu.level_select怎么用?Python Menu.level_select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Menu.Menu的用法示例。


在下文中一共展示了Menu.level_select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from Menu import Menu [as 别名]
# 或者: from Menu.Menu import level_select [as 别名]

#.........这里部分代码省略.........
                elif option == 4:
                    """links"""
                    current_state = "links"

                elif option == 5:
                    """credits"""
                    current_state = "credits"

                elif option == 6:
                    """quit"""
                    done = True

            main_menu.render(screen)
            screen.blit(menu_cursor_image, (mouse_pos[0]-16, mouse_pos[1]-16))

            pygame.display.flip()

        elif current_state == "help":
            main_menu.help_screen(screen,mouse_pos)
            pressed_keys = pygame.key.get_pressed()
            if pressed_keys[pygame.K_ESCAPE]:
                current_state = "menu"
            pygame.display.flip()

        elif current_state == "links":
            if main_menu.links(screen,mouse_pos,time_passed_seconds) == "link":
                current_state = "menu"
            pressed_keys = pygame.key.get_pressed()
            if pressed_keys[pygame.K_ESCAPE]:
                current_state = "menu"
            pygame.display.flip()

        elif current_state == "level select":
            selected_level = main_menu.level_select(screen, mouse_pos, time_passed_seconds, main_world)
            if selected_level is not None:
                current_state = "game"
                main_world.game_over = False
                pygame.mixer.music.stop()
                main_world.set_up_level(selected_level)
                main_world.level_index = main_world.levels.index(selected_level)

            pressed_keys = pygame.key.get_pressed()
            if pressed_keys[pygame.K_ESCAPE]:
                current_state = "menu"
            pygame.display.flip()

        elif current_state == "credits":
            main_menu.credits(screen,mouse_pos,time_passed_seconds)
            pressed_keys = pygame.key.get_pressed()
            if pressed_keys[pygame.K_ESCAPE]:
                current_state = "menu"
            pygame.display.flip()

        elif current_state == "game":
            movement = vec2()
            pressed_keys = pygame.key.get_pressed()
            if pressed_keys[pygame.K_a]:
                movement.x -= 1
            if pressed_keys[pygame.K_d]:
                movement.x += 1

            if pressed_keys[pygame.K_w]:
                movement.y -= 1
            if pressed_keys[pygame.K_s]:
                movement.y += 1
开发者ID:robert-fiedor,项目名称:983-Python-Play,代码行数:69,代码来源:SLCGame.py


注:本文中的Menu.Menu.level_select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。