Question

Is it possible to add a child to a CCSpriteBatchNode that was itself added as a child of the batch node? Pretty much I have lets say spriteA that I want to be in a relative location to spriteB when I do a CCAction for it. spriteB was added as a child of the batch node. Now can I have spriteA added as a child of spriteB or no?

Edit: It seems I am getting this crash because spriteA doesn't have the same texture as spriteB. So how would I have spriteB added as a child to spriteA even though they have different textures?

Right now I am trying this and I am getting a EXC_BAD_ACCESS crash:

*** Assertion failure in -[CCSpriteExtended addChild:z:tag:], /cocos2d/CCSprite.m:568

Is this possible or no? I just always want spriteA in a relative location to spriteB even when it is moving around the screen. Is this possible?

Thanks!

Was it helpful?

Solution

All sprites in a SpriteBatchNode should use the same texture. So what you want to do isn't possible.

You might want to override update and manually position spriteA relatively to B

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top