I’m developing a space game for iOS with cocos2d 2.0.
I need to add a “health bar” for each “game objects” involved in the scene,
so I decided to use the CCProgressTimer.
Usually, it’s good choice to use Sprite sheets, so I have a CCBatchNode.
The problem is related to the relationship between the ProgressTimer and the Sprites and the BatchNode.
If I add each health bar as child of its specific sprite (added to the BatchNode) my app crashes.
I’ve read about this problem, and this “operation” seems not allowed,
also someone talks about a class extension because cocos2d has not this feature.
Is it true? Or I misunderstood?
How we can handle this properly?
Thanks,
MP
Thanks for your suggestion.
I’ve solved the problem by sending a reference of the Game Layer to the GameObject class so you can define your healthBar and add it on the layer.