Question

I'm using cocos2d 1.0.1.

I've created a CCSpriteBatchNode, it includes a CCSprite (let's name it parentLayer) which includes some X number of childs(CCSprites).

The problem is - when I rotate parentLayer all sprites (childs) correctly displayed, however bounding boxes are at the same place (where they've been before rotation), so world coordinates of those sprites won't be changed.

Off course, all of the above works great without CCSpriteBatchNode. But, I would like to use batch node due to amount of sprites involved.

The question is, is there any way to update bounding boxes & child positions correspondingly?

Was it helpful?

Solution

How many sprites are we talking about? I would just go with a fast enumeration call to rotate each one individually. I nave never noticed a performance hit when doing this, have you?

CCArray *listOfChildren = [parentLayer children];
for (CCSprite *sprite in listOfChildren) {
    [sprite setRotation:someValue];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top