本文整理汇总了Python中World.add_building方法的典型用法代码示例。如果您正苦于以下问题:Python World.add_building方法的具体用法?Python World.add_building怎么用?Python World.add_building使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.add_building方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import World [as 别名]
# 或者: from World import add_building [as 别名]
#.........这里部分代码省略.........
if event.type == QUIT:
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