Suppose I have a Car object that consists of an engine, window, body, car wheels, etc. as instance variables. If I would like to give this car the ability to "disappear" or fade from the screen, then I might use the FadeIn/FadeOut actions.
Presently my car is a cocosnode, my window, wheels, and car body are all sprites. I would like to be able to be able to do something like
[carInstance do: [FadeOut actionWithDuration:3]];
and have all the components of the car fade together. I would like to avoid a loop that runs through each component and fades them one at a time.
My question is I'm not sure how to implement this. Is it enough that the Car class (type CocosNode) adopt the <CocosNodeOpacity> protocol? Do all the instance variables that are displayed need to adopt it as well? Do I need to implement methods setOpacity and Opacity for each object that adopts <CocosNodeOpacity>? Should I add each instance variable (component) as a child of the car?
Any insight is appreciated.