本文整理汇总了Python中animation.Animation.texture方法的典型用法代码示例。如果您正苦于以下问题:Python Animation.texture方法的具体用法?Python Animation.texture怎么用?Python Animation.texture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类animation.Animation
的用法示例。
在下文中一共展示了Animation.texture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import texture [as 别名]
def __init__(self, speed, starting_position, texture, window_rectangle, collision_manager):
self.window_rectangle = window_rectangle
self.starting_position = starting_position
self.speed = speed
self.collision_manager = collision_manager
self.direction = 1 if speed > 0 else -1
# Plane
fly_anim = Animation()
fly_anim.texture = texture
fly_anim.add_frame(sf.Rectangle((0, 0), (88, 73)))
fly_anim.add_frame(sf.Rectangle((88, 0), (88, 73)))
fly_anim.add_frame(sf.Rectangle((176, 0), (88, 73)))
fly_anim.add_frame(sf.Rectangle((88, 0), (88, 73)))
self.plane = AnimatedSprite(sf.seconds(0.2), False, True)
self.plane.play(fly_anim)
self.plane.size = sf.Vector2(self.plane.global_bounds.width / 2, self.plane.global_bounds.height / 2)
self.plane.origin = self.plane.global_bounds.width / 2.0, self.plane.global_bounds.height / 2.0
self.plane.scale((self.direction * 0.5, 0.5))
self.plane.position = self.starting_position
self.plane_speed = sf.Vector2(speed, 0)
self.is_dead = False
self.jump_time = None
self.plane_jumped = False
self.immortal = None
self.bullets = set()
SoundManager.play_player_appear_sound()