def render(self, display):
"""
Paints the Sprite with its current image onto the given Display object.
:param Display display: the Display object to render on (Display has a pygame.Surface, on which we blit our image)
"""
if self.image:
#print("render at x={}".format(self.rect.x + self.image_rect.x - display.offsets[0]))
display.surface.blit(self.image, (self.rect.x + self.image_rect.x - display.offsets[0], self.rect.y + self.image_rect.y - display.offsets[1]))
if DEBUG_FLAGS & DEBUG_RENDER_SPRITES_RECTS:
pygame.draw.rect(display.surface, DEBUG_RENDER_SPRITES_RECTS_COLOR,
pygame.Rect((self.rect.x - display.offsets[0], self.rect.y - display.offsets[1]),
(self.rect.w, self.rect.h)), 1)
评论列表
文章目录