因此,假设您有一个精灵组,并且您向其中添加了一堆东西:
all_shelfs = pygame.sprite.Group()
shelf_tracking_list = []
#making shelfs
build_lvl = HEIGHT - 150
#group A
for i in xrange(100):
wid = random.randint(120,320)
pos = [random.randint(0, WIDTH-wid), random.randint(build_lvl-20, build_lvl), wid]
all_shelfs.add(Shelf(pos[0],pos[1], pos[2]))
build_lvl = build_lvl - 60
#group B
for i in xrange(100):
wid = random.randint(120,320)
pos = [random.randint(0, WIDTH-wid), random.randint(build_lvl-20, build_lvl), wid]
all_shelfs.add(Shelf(pos[0],pos[1], pos[2]))
build_lvl = build_lvl - 60
#group C
for i in xrange(100):
wid = random.randint(120,320)
pos = [random.randint(0, WIDTH-wid), random.randint(build_lvl-20, build_lvl), wid]
all_shelfs.add(Shelf(pos[0],pos[1], pos[2]))
build_lvl = build_lvl - 60
shelf_tracking_list = all_shelfs.sprites()
例如,如何删除 A 组?这是我添加的第一组。我注意到我不能真正使用这个shelf_tracking_list修改组