【发布时间】:2018-11-24 08:53:48
【问题描述】:
我想在 pygame 中加载图像的特定部分。 我该怎么做? 我有一个不同角度的人物形象。在 SDL 中我们使用 rect,但是在 pygame 中我们有这个选项吗?
【问题讨论】:
-
您也可以使用
pygame.Surface.subsurface方法,但必须确保矩形在图像区域内。
标签: pygame pygame-surface
我想在 pygame 中加载图像的特定部分。 我该怎么做? 我有一个不同角度的人物形象。在 SDL 中我们使用 rect,但是在 pygame 中我们有这个选项吗?
【问题讨论】:
pygame.Surface.subsurface 方法,但必须确保矩形在图像区域内。
标签: pygame pygame-surface
https://www.pygame.org/docs/ref/surface.html#pygame.Surface.blit 使用surface.blit(source, dest, area=None, special_flags = 0))。 area 参数将允许您放置要绘制的图像的哪个部分的矩形
【讨论】: