所以我开始玩游戏来打发时间,但我不知道如何解决这个问题: 我的播放器是精灵薄片的一部分,精灵薄片有一个阿尔法层,所以它是透明的,但当我将我的精灵薄片分割成小的精灵时,这个阿尔法层消失了,我有一个黑色的BG…我试着用set_Colorkey([0,0,0])go 掉黑色的bg,但因为我的播放器是深色皮肤,所以我的播放器部分消失了.有什么建议吗?
import pygame
class Player(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
self.image = pygame.image.load("assets/img/plr.png")
self.image = self.get_image(0, 0)
self.image = pygame.transform.scale(self.image, (96, 96))
self.image.set_colorkey([0, 0, 0])
self.rect = self.image.get_rect(center=(250, 250))
def get_image(self, x, y):
image = pygame.Surface([48, 48])
image.blit(self.image, (0, 0), (x, y, 48, 48))
return image
def update(self):
pass