Game Development Community

Delete child images assigned to parent image?

by amaranthia · in Torque Game Builder · 03/05/2008 (12:32 pm) · 2 replies

I've run into a little problem...

In my game, I have a parent image that can have up to 100 children images mounted to it. I've figured out how to mount an image to another image through scripting, but I'm not sure how to delete a bunch of child images assigned parent image without deleting the parent image.

Is there an easy way to delete a bunch of images that are mounted to a parent image?

#1
03/05/2008 (12:50 pm)
If you're using 1.7 or later, you can use the getAllMountedChildren() method to get a list of objects that are mounted to an object, e.g.
%objList = %mainObject.getAllMountedChildren();
for (%i=0; %i < getWordCount(%objList); %i++)
{
   %child = getWord(%objList, %i);
   %child.delete();
}
#2
03/10/2008 (10:40 am)
It worked! Thanks! :D