本文整理汇总了Python中pyglet.sprite.Sprite.scale方法的典型用法代码示例。如果您正苦于以下问题:Python Sprite.scale方法的具体用法?Python Sprite.scale怎么用?Python Sprite.scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyglet.sprite.Sprite
的用法示例。
在下文中一共展示了Sprite.scale方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: players_lives
# 需要导入模块: from pyglet.sprite import Sprite [as 别名]
# 或者: from pyglet.sprite.Sprite import scale [as 别名]
def players_lives(num_icons, batch=None):
lives_left = []
for idx in range(num_icons):
new_sprite = Sprite(img=resources.get_image('engine_stop'),
x=785-idx*30, y=585, batch=batch)
new_sprite.scale = 0.3
lives_left.append(new_sprite)
return lives_left
示例2: sprites
# 需要导入模块: from pyglet.sprite import Sprite [as 别名]
# 或者: from pyglet.sprite.Sprite import scale [as 别名]
def sprites(self, image, x, y, scale=1.0):
from pyglet.sprite import Sprite
for i in range(len(x)):
sprite = Sprite(image, batch=self._batch)
sprite.x = x[i]
sprite.y = y[i]
sprite.scale = scale
self._sprites.append(sprite)
示例3: background_2
# 需要导入模块: from pyglet.sprite import Sprite [as 别名]
# 或者: from pyglet.sprite.Sprite import scale [as 别名]
def background_2(self, dt):
"""Random stars created in back moving faster"""
fast_star = Sprite(images['star'], batch=self.fast_star_batch)
fast_star.y = random.uniform(0, self.height)
fast_star.x = self.width
fast_star.scale = random.uniform(0.2, 2)
self.fast_stars.append(fast_star)
示例4: background_1
# 需要导入模块: from pyglet.sprite import Sprite [as 别名]
# 或者: from pyglet.sprite.Sprite import scale [as 别名]
def background_1(self, dt):
"""create random number of stars at random y co ordinates"""
#for star in self.star:
star = Sprite(images['star'], batch=self.star_batch)
star.y = random.uniform(0,self.width-2)
star.x = self.width
star.scale = random.uniform(0.2, 2)
self.stars.append(star)
示例5: player_icons
# 需要导入模块: from pyglet.sprite import Sprite [as 别名]
# 或者: from pyglet.sprite.Sprite import scale [as 别名]
def player_icons(self, batch=None):
self._life_icons = set()
WIDTH = self.win_size[0]
HEIGHT = self.win_size[1]
for idx in range(self._num_lives):
new_sprite = Sprite(img=resources.get_image('engine_stop'),
x=WIDTH - 15 - idx * 30, y=HEIGHT - 15, batch=batch)
new_sprite.scale = 0.3
new_sprite.rotation = -90
self._life_icons.add(new_sprite)
return self._life_icons