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


Python World.test_buildable方法代码示例

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


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

示例1: run

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

#.........这里部分代码省略.........
                quit()
                
            if event.type == MOUSEBUTTONDOWN:
                if ( pos.x > clip.minimap_rect.x and pos.y > clip.minimap_rect.y ):
                    pass
                else:
                    if event.button == 1 and held == 1:
                        held = 1
                        start = Vector2(*pygame.mouse.get_pos())
                        draw = True
                        
                        if ( pos.x < clip.side.w ) and (pos.y < clip.side.top_rect.h):
                            for L in clip.side.tiles:
                                for T in L:
                                    if T == None:
                                        continue
                                    
                                    if T.rect.collidepoint((pos.x, pos.y)):
                                        if T.selected:
                                            T.selected = False
                                        else:
                                            T.selected = True
                                            
                                        selected_building = T.rep
                                        clip.side.update(T)
                                        
                        else:
                            selected_building = None
                            clip.side.update()
                            
                        
                    if event.button == 3 and selected_building != None:
                        world.add_building(selected_building, pos)
                        if world.test_buildable(selected_building, pos):
                            selected_building = None
                            clip.side.update()
            
            if event.type == MOUSEBUTTONUP:
                held = 0
                draw = False
                    
            if event.type == KEYDOWN:
                if event.key == K_F2:
                    str1 =  str(datetime.now())
                    str1 = str1.split(".")
                    str2 = str1[0]+str1[1]
                    str2 = str2.split(":")
                    str1 = ""
                    for i in str2:
                        str1+=i
                    pygame.image.save(screen, "Images/Screenshots/SCREENSHOT%s.png"%str1)
                    
            if event.type == VIDEORESIZE:
                Owidth, Oheight = event.size
                    
            
                
        #------------------Keys Below--------------------------------------------------
        pressed_keys = pygame.key.get_pressed()
        if pressed_keys[K_ESCAPE]:  #quits the game
            pygame.quit() 
            exit()
            
        if pressed_keys[K_SPACE]:   #Resets wood
            world.wood = 0
        
开发者ID:wazzup771,项目名称:AICivGame,代码行数:69,代码来源:NewVillagerSim.py


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