我已经建造了一所房子,有很多墙我想添加到我的Sprite组中,但是我不知道如何。这是一个列表,我无法在图像周围绘制矩形。
hit_wall = pygame.sprite.spritecollide(PLAYER,WALL,False)
class inside_house(pygame.sprite.Sprite):
def __init__(self,x,y):
pygame.sprite.Sprite.__init__(self,WALL)
self.bg_color = (255,255,255)
self.x = x
self.y = y
self.done = False
self.load_images()
self.image = self.image_dic[0]
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
self.get_out = 375
def load_images(self):
self.image_dic = [
pygame.image.load("first_games/adventure_game/graphics/buildings/wall1.png").convert_alpha(),pygame.image.load("first_games/adventure_game/graphics/buildings/wall2.png").convert_alpha(),pygame.image.load("first_games/adventure_game/graphics/buildings/wall3.png").convert_alpha(),pygame.image.load("first_games/adventure_game/graphics/buildings/wall4.png").convert_alpha(),]