I need to create an object that contains several sprites (2 for simplicity: the game object and its' shadow). I need to compose them into the same class, so having the following questions:
what is the best ancestor class to the described one? I used
CCNode
for this purpose. I overridden itsdraw
method in the following way:- (void)draw { [super draw]; [_item draw]; [_itemShadow draw]; }
and suddenly found that need to change all other CCNode methods in the same way. For ex. change position
, visible
, etc. in order to change these properties in both Sprites my custom container aggregates:
@interface NBChecker : CCNode {
CCSprite *_item;
CCSprite *_itemShadow;
}
@end
There is the other way I see - to make both sprites parent
property pointing to self
. This should synchronise positions, visibility, etc. for these sprites.
Who has better ideas? Would like to use aggregation and not sure I'm right in my thoughts.
Thanks!