我正在与丘陵进行平台游戏。我有一个带有参数的类,一个带有自定义项的数组以及一个用于创建它们的for循环。但是,我不断收到此错误:“ AttributeError:'tuple'对象没有属性'player'?
class HillPlatform(Platform):
def __init__(self, sprite_sheet_data):
super().__init__(sprite_sheet_data)
self.player = None
self.level = None
self.rect = self.image.get_rect()
self.mask = pygame.mask.from_surface(self.image)
class Level(object):
def __init__(self, player):
self.hill_list = None
self.hill_list = pygame.sprite.Group()
self.player = player
def update(self):
self.hill_list.update()
def draw(self, screen):
screen.hill_list.draw(screen)
class Level01(Level):
def __init__(self, player):
Level.__init__(self, player)
level_hill_blocks = [(GRASS_HILL_RIGHT_1, 100, 400)]
for hill in level_hill_blocks:
hill.player = self.player
hill.level = self
self.platform_boundary_list.add(hill)