本文整理汇总了Python中World.World.process方法的典型用法代码示例。如果您正苦于以下问题:Python World.process方法的具体用法?Python World.process怎么用?Python World.process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World.World
的用法示例。
在下文中一共展示了World.process方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from World import World [as 别名]
# 或者: from World.World import process [as 别名]
#.........这里部分代码省略.........
if not bool_full:
pygame.mouse.set_pos((pos.x, 15))
world.background_pos.y += 500 * time_passed_seconds
if world.background_pos.y > 0:
world.background_pos.y = 0
elif int(pos.y) >= screen_height - 16:
if not bool_full:
pygame.mouse.set_pos((pos.x, screen_height - 16))
world.background_pos.y -= 500 * time_passed_seconds
if world.background_pos.y < -1 * (world.h - screen_height):
world.background_pos.y = -1 * (world.h - screen_height)
if pygame.mouse.get_pressed()[0]:
if pos.x > world.clipper.minimap_rect.x and pos.y > world.clipper.minimap_rect.y:
""" If the player clicked on the mini map,
go to that location with the view centered on the event position"""
draw = False
if not held:
# E712 comparison to True should be 'if cond is not True:' or 'if not cond:'
world.background_pos.x = (-1 * (pos.x - world.clipper.minimap_rect.x) * world.clipper.a) + (
world.clipper.rect_view_w * world.clipper.a) / 2
world.background_pos.y = (-1 * (pos.y - world.clipper.minimap_rect.y) * world.clipper.b) + (
world.clipper.rect_view_h * world.clipper.b) / 2
# --------------Mouse Above---------------------------------------
# --------------Process below-------------------------------------
world.process(time_passed_seconds)
if selected_building == "House":
selected_img = placing_house_img
elif selected_building == "LumberYard":
selected_img = placing_lumberyard_img
elif selected_building == "Dock":
selected_img = placing_dock_img
elif selected_building == "Manor":
selected_img = placing_manor_img
# --------------Process above-------------------------------------
# --------------Render Below------------------------
screen.fill((0, 0, 0))
world.render_all(screen, time_passed_seconds, pos)
world.grow_trees(world.baby_tree_locations)
if selected_building is not None:
if (pos.x > world.clipper.minimap_rect.x and pos.y > world.clipper.minimap_rect.y) or (
pos.x < world.clipper.side.w + 32):
pass
else:
if not world.test_buildable(selected_building, 0, pos):
selected_img = bad_lumberyard_img
blit_pos = world.get_tile_pos(pos - world.background_pos) * 32
screen.blit(selected_img, ((blit_pos.x - (selected_img.get_width() - 32)) + world.background_pos.x,
(blit_pos.y - (selected_img.get_height() - 32)) + world.background_pos.y))
# This is for selecting-------------
if draw and selected_building is None:
# E712 comparison to True should be 'if cond is True:' or 'if cond:'