Cahin destroy events

BlitzMax Forums/BlitzMax Beginners Area/Cahin destroy events

Ryan Burnside(Posted 2006) [#1]
>the title needs to be called Chain destruction events<

Ok I have objects that link together like links in a chain. When one object is destroyed all the objects that are attached to it and have been spawned from it should be destroyed also. I suppose you could visualize a tree, if you cut a large branch all the smaller brances attached to the larger brach get seperated from the main body too. What is the best way to keep track of what objects are spawned from an object and how to destroy the smaller branches of an object. All the objects are the same type. I thought of setting an id number for each object called id and another called parent. I would have too loop through all the objects' id's to find if the creator is destroyed and if so, destroy the created object. This seems like a bad idea as one could run out of number's for id's.




kfprimm(Posted 2006) [#2]


I think that should do what you need it to do. Untested but it should work.