It’d be convenient to control and sort objects by a convenient container in the system.
have a script that looks for a property and stores a list of them
property = Group2 etc.
otherwise I think groups are lost when you press P
That’s awfully inconvenient.
parent all of them to a “spawn” item, then
do
add= scene.addobject("spawn",own,0)
add.worldPosition=(x,y,z)
for item in add.childrenRecursive
if 'Group' not in item:
item['Group']=group
for item in add.childrenRecursive
if 'BreakOff' in item:
item.removeParent()
Why would you just not use the spawn item (the parent) their container instead of property hassle? Name it group and there’s a perfect place to hold them. groupMembers = group.children and for group member the group = own.parent.
What are going to do?
I’m trying to keep track of the small handful of gameplay-relevant objects in a scene where numerous complex objects may exist. In a fighting game, there’s only the stage’s collision body, fighters, and maybe a few projectiles to keep of; but the stage may have any number of cosmetic features that don’t need to be tracked by any gameplay monitor.
I wanted to avoid building a function where each object reports itself to a monitoring object, but it struck me that I’d need to do that for the sake of tracking unique values (a homing fireball would need to report things a fallen sword would not) anyway. I can just toss in a few lines at the end of each gameplay object’s central recurring code, so hey~
if 'init' no in own:
GroupList=[]
scene=bge.logic.getCurrentScene()
for item in scene.objects:
if 'Group' in item:
GroupList+=[item]
own['GroupList']=GroupList
own['init']=True