I created some groups (pygame.sprite.LayeredUpdates) as global variable in my code. But when I use "groupA = groupB" and "groupA.empty()", it shows that groupB is also empty.
if not in_bag_intro:
all_sprite = bag_sprite
background_sprite.empty()
else:
all_sprite.empty()
print(bag_sprite.sprites()) #result:[]
all_sprite.add(bag_item_intro)
background_sprite = bag_sprite
Besides, this part is in a while-loop, so I don't want to copy a sprite each time to save memory. Now I use a flag to see if all_sprite need change (ex: the moment that "in_bag_intro" turns to True or False, I'll change the flag into True). But if I run this code for a long time, the times it copy will still over 100 times.
By the way, does group.copy() consume memory? I ask this question because of the result "sprite XXX (in 1000 groups)"