本文整理汇总了Python中spritesheet_functions.SpriteSheet.getImage方法的典型用法代码示例。如果您正苦于以下问题:Python SpriteSheet.getImage方法的具体用法?Python SpriteSheet.getImage怎么用?Python SpriteSheet.getImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spritesheet_functions.SpriteSheet
的用法示例。
在下文中一共展示了SpriteSheet.getImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from spritesheet_functions import SpriteSheet [as 别名]
# 或者: from spritesheet_functions.SpriteSheet import getImage [as 别名]
def __init__(self, sprite_sheet_data ):
""" Platform constructor. Assumes constructed with user passing in
an array of 5 numbers like what's defined at the top of this code. """
pygame.sprite.Sprite.__init__(self)
sprite_sheet = SpriteSheet("tiles_spritesheet.png")
# Grab the image for this platform
self.image = sprite_sheet.getImage(sprite_sheet_data[0],
sprite_sheet_data[1],
sprite_sheet_data[2],
sprite_sheet_data[3])
self.rect = self.image.get_rect()
示例2: __init__
# 需要导入模块: from spritesheet_functions import SpriteSheet [as 别名]
# 或者: from spritesheet_functions.SpriteSheet import getImage [as 别名]
def __init__(self):
""" Constructor function """
# Call the parent's constructor
pygame.sprite.Sprite.__init__(self)
sprite_sheet = SpriteSheet("p1_walk.png")
# Load all the right facing images into a list
image = sprite_sheet.getImage(0, 0, 66, 90)
self.walking_frames_r.append(image)
image = sprite_sheet.getImage(66, 0, 66, 90)
self.walking_frames_r.append(image)
image = sprite_sheet.getImage(132, 0, 67, 90)
self.walking_frames_r.append(image)
image = sprite_sheet.getImage(0, 93, 66, 90)
self.walking_frames_r.append(image)
image = sprite_sheet.getImage(66, 93, 66, 90)
self.walking_frames_r.append(image)
image = sprite_sheet.getImage(132, 93, 72, 90)
self.walking_frames_r.append(image)
image = sprite_sheet.getImage(0, 186, 70, 90)
self.walking_frames_r.append(image)
# Load all the right facing images, then flip them
# to face left.
image = sprite_sheet.getImage(0, 0, 66, 90)
image = pygame.transform.flip(image,True,False)
self.walking_frames_l.append(image)
image = sprite_sheet.getImage(66, 0, 66, 90)
image = pygame.transform.flip(image,True,False)
self.walking_frames_l.append(image)
image = sprite_sheet.getImage(132, 0, 67, 90)
image = pygame.transform.flip(image,True,False)
self.walking_frames_l.append(image)
image = sprite_sheet.getImage(0, 93, 66, 90)
image = pygame.transform.flip(image,True,False)
self.walking_frames_l.append(image)
image = sprite_sheet.getImage(66, 93, 66, 90)
image = pygame.transform.flip(image,True,False)
self.walking_frames_l.append(image)
image = sprite_sheet.getImage(132, 93, 72, 90)
image = pygame.transform.flip(image,True,False)
self.walking_frames_l.append(image)
image = sprite_sheet.getImage(0, 186, 70, 90)
image = pygame.transform.flip(image,True,False)
self.walking_frames_l.append(image)
# Set the image the player starts with
self.image = self.walking_frames_r[0]
# Set a referance to the image rect.
self.rect = self.image.get_rect()