I can't seem to find an elegant way to animate sprite hierarchies. That is, if I have a sprite with a child sprite, and I would like both to animate, I can't just run DoStep() on the parent and expect the child to also have DoStep() called on it. The API refers to a function that returns an item of type GlInsideNodeIt< KrImNode * >, but the source code mentions that it shouldn't be used.
It seems the best solution for now is to keep a more complete list of sprites that I want to animate, but this will make it a bit tricky when I am deleting and adding sprites all the time. Is there a more elegant solution, such as a way to request the children of a sprite?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't seem to find an elegant way to animate sprite hierarchies. That is, if I have a sprite with a child sprite, and I would like both to animate, I can't just run DoStep() on the parent and expect the child to also have DoStep() called on it. The API refers to a function that returns an item of type GlInsideNodeIt< KrImNode * >, but the source code mentions that it shouldn't be used.
It seems the best solution for now is to keep a more complete list of sprites that I want to animate, but this will make it a bit tricky when I am deleting and adding sprites all the time. Is there a more elegant solution, such as a way to request the children of a sprite?
Good point. Missing feature there. Should have DoStepRecursive() as well.
You can walk the children of a node:
GlInsideNodeIt<KrImNode*> it = monsters->ChildTreeIterator();
it.Begin();
while( !it.Done() )
{
...and do so recursively if needed. That's probably easier (and safer) than maintaining a separate list of things to update.
lee