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


Python World.new_world方法代码示例

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


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

示例1: run

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

#.........这里部分代码省略.........
                            world.clipper.side.update()

                    if event.button == 3 and selected_building is not None:
                        world.add_building(selected_building, pos)
                        if world.test_buildable(selected_building, 0, pos):
                            selected_building = None
                            world.clipper.side.update()

            if event.type == pygame.MOUSEBUTTONUP:
                draw = False
                held = False

            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_F2 or event.key == pygame.K_F3 or \
                        event.key == pygame.K_F4:
                    str1 = str(datetime.now())
                    str1 = str1.split(".")
                    str2 = str1[0] + str1[1]
                    str2 = str2.split(":")
                    str1 = ""
                    for i in str2:
                        str1 += i
                        
                    if event.key == pygame.K_F2:
                        pygame.image.save(screen, "Images/Screenshots/SCREENSHOT%s.png" %str1)
                        
                    elif event.key == pygame.K_F3:
                        pygame.image.save(world.clipper.minimap, "Images/Screenshots/MinimapSCREENSHOT%s.png" %str1)
                        
                    elif event.key == pygame.K_F4:
                        pygame.image.save(world.background, "Images/Screenshots/FULL_MAP_RENDER%s.png" %str1)
                        
                if event.key == pygame.K_n:
                    world.new_world()

                if event.key == pygame.K_ESCAPE:
                    done = True

            if event.type == pygame.VIDEORESIZE:
                screen_width, screen_height = event.size

        # ------------------Keys Below--------------------------------------
        pressed_keys = pygame.key.get_pressed()
        if pressed_keys[pygame.K_ESCAPE]:  # quits the game
            done = True

        if pressed_keys[pygame.K_SPACE]:  # Resets wood
            world.wood = 0

        if pressed_keys[pygame.K_d]:  # Fast-forward function
            world.clock_degree += 5

        # Test to see what the first entity'select_surface state is
        if pressed_keys[pygame.K_l]:
            print world.entities[0].brain.active_state

        # --------------Keys Above----------------------------------------
        # --------------Mouse Below---------------------------------------

        if int(pos.x) <= 15:
            if not bool_full:
                pygame.mouse.set_pos((15, pos.y))
            world.background_pos.x += 500 * time_passed_seconds
            # print world.background_pos.x
            if world.background_pos.x > side_size:
                world.background_pos.x = side_size
开发者ID:DaxHacker,项目名称:DealershipSimulation,代码行数:70,代码来源:NewVillagerSim.py


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