If I add 100 CCNodes to a CCLayer and some of them are CCSprite is there any functionality like this:
CCLayer->getAllNodesByType();
or
CCLayer->getAllNodesByTypeName(“CCSprite”);
which would return all the CCSprite’s in the CCLayer?
Or some way to return all instances of CCSprite* from a list of CCNode*?
WenHai
#2
You can do it by dynamic_cast,tag or use data.
WenHai,
Thanks… actually after studying Cocos2d some more I’ve decided I won’t need this method I make.
It was:
CCNode * RBObject::getNodeByID(const char *id);
Where my game object clas, RBObject, has a list of CCNode*
I decided to store important CCNodes, like CCSprite, with another pointer. It’s a little more memory space but faster access time.