當前位置: 首頁>>代碼示例>>Python>>正文


Python View.set_camera_loc方法代碼示例

本文整理匯總了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()
開發者ID:rayman42003,項目名稱:INF123-VVPilot,代碼行數:33,代碼來源:SinglePlayer.py

示例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))
開發者ID:rayman42003,項目名稱:INF123-VVPilot,代碼行數:32,代碼來源:Client.py


注:本文中的View.View.set_camera_loc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。