pygameでパックマンゲームを作成しようとしていますが、いくつか問題が発生しました。「食べ物」にはイメージがないと言っているのです。
これは私のパックマンゲーム[コード編集済み]です。
問題は、このエリアに何か問題があり、食べ物に属性画像がないことを教えてくれることです
class Food(pygame.sprite.Sprite):
def __init__(self,x,y,color):
pygame.sprite.Sprite.__init__(self)
pygame.image = pygame.Surface([7,7])
self.image.fill(color)
self.rect = self.image.get_rect()
self.rect.top = y
self.rect.left = x
def update (self,player):
collidePlayer = pygame.sprite.spritecollide(self,player,False)
if collidePlayer:
food.remove