def render(self, display):
"""
Blits a part of our Sprite's image onto the Display's Surface using the Display's offset attributes.
:param Display display: the Display object to render on
"""
assert self.do_render, "ERROR: TiledTileLayer.render() called but self.do_render is False!"
assert not isinstance(self.pygame_sprite, Sprite), "ERROR: TiledTileLayer.render() called but self.pygame_sprite is not a Sprite!"
r = pygame.Rect(self.pygame_sprite.rect) # make a clone so we don't change the original Rect
# apply the display offsets (camera)
r.x += display.offsets[0]
r.y += display.offsets[1]
r.width = display.width
r.height = display.height
display.surface.blit(self.pygame_sprite.image, dest=(0, 0), area=r)
评论列表
文章目录