本文整理汇总了Python中World.World.get_vnn_array方法的典型用法代码示例。如果您正苦于以下问题:Python World.get_vnn_array方法的具体用法?Python World.get_vnn_array怎么用?Python World.get_vnn_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World.World
的用法示例。
在下文中一共展示了World.get_vnn_array方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import get_vnn_array [as 别名]
def run():
"""Run the Game"""
tile_size = 32
font = pygame.font.SysFont("Terminal", 20)
bool_full = 0
screen_size = (1280, 720)
screen_width, screen_height = screen_size
side_size = screen_width / 5.0
if bool_full:
screen = pygame.display.set_mode(screen_size, pygame.FULLSCREEN | pygame.HWSURFACE, 32)
else:
screen = pygame.display.set_mode(screen_size, 0, 32)
draw = False
held = False
size = (128, 128)
w_size = size[0] * tile_size, size[1] * tile_size
seed = None
# print seed
world = World(screen_size, w_size, font, seed, screen)
print world.get_vnn_array(Vector2(), 3)
# These are all loaded here to be used in the main file.
# TODO: Move these somewhere else
placing_lumberyard_img = pygame.image.load("Images/Buildings/Dark_LumberYard.png").convert()
placing_lumberyard_img.set_colorkey((255, 0, 255))
placing_house_img = pygame.image.load("Images/Buildings/Dark_House.png").convert()
placing_house_img.set_colorkey((255, 0, 255))
placing_dock_img = pygame.image.load("Images/Buildings/Dark_Dock.png").convert()
placing_dock_img.set_colorkey((255, 0, 255))
placing_manor_img = pygame.image.load("Images/Buildings/Dark_Manor.png").convert()
placing_manor_img.set_colorkey((255, 0, 255))
bad_lumberyard_img = pygame.image.load("Images/Buildings/Red_LumberYard.png").convert()
bad_lumberyard_img.set_colorkey((255, 0, 255))
world.clipper = Clips(world, (screen_width, screen_height))
selected_building = "LumberYard"
selected_img = pygame.image.load(
"Images/Buildings/Dark_LumberYard.png").convert()
selected_img.set_colorkey((255, 0, 255))
world.clock.tick()
done = False
while not done:
time_passed_seconds = world.clock.tick(60) / 1000.
pos = Vector2(*pygame.mouse.get_pos())
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
if event.type == pygame.MOUSEBUTTONDOWN:
if (pos.x > world.clipper.minimap_rect.x and pos.y >
world.clipper.minimap_rect.y):
pass
else:
if event.button == 1:
# TODO: Figure out what the fuck this does
held = True
start = Vector2(*pygame.mouse.get_pos())
draw = True
if (pos.x < world.clipper.side.w) and (pos.y < world.clipper.side.top_rect.h):
for tile_list in world.clipper.side.tiles:
for tile in tile_list:
if tile is None:
continue
if tile.rect.collidepoint((pos.x, pos.y)):
if tile.selected:
tile.selected = False
else:
tile.selected = True
selected_building = tile.rep
world.clipper.side.update(tile)
else:
selected_building = None
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
#.........这里部分代码省略.........