def setimage(self,ishape):
"""Set the image of the Sprite.
Arguments:
ishape -- an image, or an image, rectstyle. The rectstyle will
describe the shape of the image, used for collision detection.
"""
if not isinstance(ishape, tuple):
ishape = ishape,None
image,shape = ishape
if shape == None:
shape = pygame.Rect(0,0,image.get_width(),image.get_height())
if isinstance(shape, tuple):
shape = pygame.Rect(shape)
self.image = image
self.shape = shape
self.rect.w,self.rect.h = shape.w,shape.h
self.irect.w,self.irect.h = image.get_width(),image.get_height()
self.updated = 1
评论列表
文章目录