图像太大

时间:2018-07-30 02:34:11

标签: python image pygame size

我不知道为什么,但是图像非常大。如果它是一个变量,我只想有人告诉我哪个。请随时更改您想要的任何内容并将其发布在下面。任何帮助表示赞赏。

        class Ball(pygame.sprite.Sprite):
            def __init__(self, x, y):
                pygame.sprite.Sprite.__init__(self)
                self.image = pygame.Surface((10, 10)).convert_alpha()
                self.image = pygame.image.load(basketball_file).convert_alpha()
                self.rect = pygame.Rect(x, y, 10, 10)
                self.x = self.rect.x
                self.y = self.rect.y
                self.speed_x = 0
                self.speed_y = 0
                self.radiusx = 0
                self.radiusy = 100
                self.mask = pygame.mask.from_surface(self.image)
                # Pass the midbottom position as an argument to `get_rect`.
                #self.rect = self.image.get_rect(midbottom=(x, y))
                # Set the x and y attributes afterwards.
                # Alternatively.
                self.rect.midbottom = x, y

            def update(self, screen_rect):  # Pass a rect with the size of the screen.
                self.x += self.speed_x
                self.y += self.speed_y
                self.rect.topleft = (self.x, self.y)
                if not screen_rect.contains(self.rect):
                    # Clamp the rect if it's outside of the screen.
                    self.rect.clamp_ip(screen_rect)
                    self.x, self.y = self.rect.topleft

            def render(self, screen):
                screen.blit(self.image, self.rect)

我猜这是一个错误。

0 个答案:

没有答案