本文整理汇总了Python中View.View.set_camera_loc方法的典型用法代码示例。如果您正苦于以下问题:Python View.set_camera_loc方法的具体用法?Python View.set_camera_loc怎么用?Python View.set_camera_loc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View.View
的用法示例。
在下文中一共展示了View.set_camera_loc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from View import View [as 别名]
# 或者: from View.View import set_camera_loc [as 别名]
botControllers.append(run_bot_func(ship))
for i in range(0, NUM_WALLS):
x = random.randint(player_ship.location[0], 3200-player_ship.location[0])
y = random.randint(player_ship.location[1], 1800-player_ship.location[1])
w = random.randint(100, 200)
h = random.randint(100, 200)
logic.wall_list.append(pygame.Rect(x, y, w, h))
logic.wall_list.append(pygame.Rect(0, 0, map_dimensions[0], 25))
logic.wall_list.append(pygame.Rect(0, 0, 25, map_dimensions[1]))
logic.wall_list.append(pygame.Rect(0, map_dimensions[1]-25, map_dimensions[0], 25))
logic.wall_list.append(pygame.Rect(map_dimensions[0]-25, 0, 25, map_dimensions[1]))
view.wall_list = logic.wall_list
view.bullet_list = logic.bullet_list
view.ship_list = logic.ship_list
clock = pygame.time.Clock()
while 1:
clock.tick(60)
for event in pygame.event.get():
if event.type == QUIT:
exit()
logic.doLogic()
read_input(controller.move_ship, controller.turn_left, controller.turn_right, controller.shoot, controller.shield_on)
for bot in botControllers:
bot()
view.set_camera_loc(player_ship.location)
view.draw_everything()
示例2: periodic_poll
# 需要导入模块: from View import View [as 别名]
# 或者: from View.View import set_camera_loc [as 别名]
# view.bullet_list = logic.bullet_list
# view.ship_list = logic.ship_list
# def periodic_poll():
# while 1:
# poll(timeout=0.0125)
#
# clock = pygame.time.Clock()
# thread = Thread(target=periodic_poll)
# thread.daemon = True # die when the main thread dies
# thread.start()
while running:
start_time = time.time()
# for event in pygame.event.get():
# if event.type == QUIT:
# exit()
# player_ship.moved = False
read_inputs(controller.move_ship, controller.turn_left, controller.turn_right, controller.shoot, controller.shield,
controller.stop_move_ship, controller.stop_turn_left, controller.stop_turn_right, controller.stop_shoot, controller.stop_shield)
for n in view.ship_list:
interpolate_ship(n, 1, flags_dict[n.id])
for n in view.bullet_list:
interpolate_bullet(n, 1)
if client.ship_id in ship_dict:
view.set_camera_loc(ship_dict[client.ship_id].location)
view.draw_everything()
current+=1
while time.time() - start_time < frame_duration:
poll(frame_duration - (time.time() - start_time))