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


Python World.wood方法代码示例

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


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

示例1: run

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

#.........这里部分代码省略.........
                        
                    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
        
        if pressed_keys[K_d]:   #Fast-forward-esk functionability
            world.clock_degree+=5
            
        if pressed_keys[K_l]:   #Test to see what the first entity's state is
            print world.entities[0].brain.active_state, world.degree
            
        #--------------Keys Above----------------------------------------
        #--------------Mouse Below---------------------------------------
        
        if int(pos.x) <= 15:
            pygame.mouse.set_pos((15, pos.y))
            world.background_pos.x+=500*time_passed_seconds
            
        elif int(pos.x) >= Owidth-16:
            pygame.mouse.set_pos((Owidth-16, pos.y))
            world.background_pos.x-=500*time_passed_seconds
            
        if int(pos.y) <= 15:
            pygame.mouse.set_pos((pos.x, 15))
            world.background_pos.y+=500*time_passed_seconds
            
        elif int(pos.y) >= Oheight-16:
            pygame.mouse.set_pos((pos.x, Oheight-16))
            world.background_pos.y-=500*time_passed_seconds
            
        if pygame.mouse.get_pressed()[0]:
            if pos.x > clip.minimap_rect.x and pos.y > clip.minimap_rect.y:
                world.background_pos.x = (-1*(pos.x-clip.minimap_rect.x)*clip.a)+(clip.rect_view_w*clip.a)/2
                world.background_pos.y = (-1*(pos.y-clip.minimap_rect.y)*clip.b)+(clip.rect_view_h*clip.b)/2
            
开发者ID:wazzup771,项目名称:AICivGame,代码行数:69,代码来源:NewVillagerSim.py


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