【问题标题】:Design for surface in pygamepygame中的表面设计
【发布时间】:2022-01-26 08:36:35
【问题描述】:

我正在制作一个游戏,我正在那里使用墙壁。我想为他们做一个设计,但我不知道该怎么做。我正在考虑制作一个图像并从中裁剪每个墙壁,这取决于它的大小。我怎样才能做到这一点?我只是在这里填充了一种颜色。

class Wall(pygame.sprite.Sprite):
    def __init__(self, x, y, width, height):
        super().__init__()
        self.image = pygame.Surface([width, height])
        self.image.fill((50,50,225)
        self.rect = self.image.get_rect()
        self.rect.y = y
        self.rect.x = x

我说的是这些墙:

【问题讨论】:

  • 只需使用绘画或其他类似的应用程序并在那里绘制它

标签: image pygame crop


【解决方案1】:

不推荐,您可以使用 tilemaps 或 tiled(pygame 模块),因为它们更容易。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多