本文整理汇总了Python中Camera.target方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.target方法的具体用法?Python Camera.target怎么用?Python Camera.target使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera
的用法示例。
在下文中一共展示了Camera.target方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EnemyGameObject
# 需要导入模块: import Camera [as 别名]
# 或者: from Camera import target [as 别名]
# Create enemy.
enemy = EnemyGameObject(all_game_objects)
enemy.position = Vector2(500, 50)
enemy.velocity = Vector2(200, 0)
enemy.fire_interval = 0.1
enemy.firing_speed = 900.0
enemy.boundingBox = Rect(enemy.position.to_tuple(), (10, 10))
enemy.color = (255, 100, 0)
enemy.target = player
enemy.fire_sfx = enemy_laser_sfx
enemy_dir = 0.0
all_game_objects.append(enemy)
# MAKE CAMERA #################################################################################
camera = Camera(Rect((0, 0), screen_size))
camera.target = player
############################################################################################
# MAKE BACKGROUND
backgrounds = list()
numBackgrounds = 5
horizon_line = screen_size[1] - 100
ground_color = (210, 180, 140)
for background in range(0, numBackgrounds):
background_img = pygame.Surface(screen_size).convert()
background_img.fill((0, 0, 0))
backgrounds.append(background_img)