Questions tagged [ccspritebatchnode]
38 questions
4
votes
1 answer
Understanding CCBatchNode in Cocos2d
I heard using CCBatchNode is way better for performances in Cocos2d. I have troubles understanding how it works. I have several subclasses of CCSprite that represent the objects in my game. So far I initialise them with the spriteWithFile: method.
I…

rmonjo
- 2,675
- 5
- 30
- 37
2
votes
1 answer
understanding sprite sheet memory consumption
I would like to know how each of the marked lines of code affect memory consumption. Given that my sprite sheet takes say 4MB in memory.
CCSpriteBatchNode *spritesBgNode; // Line 1
spritesBgNode = [CCSpriteBatchNode…

NSCodeman
- 51
- 4
2
votes
1 answer
Add Animation to existing CCSprite by Tag Value
I have created Animation for a character..need help to add this animation to existing character by its tag value..
As far I check on net..all are creating new CCSprite to make this animate..but i need it to add this animation to existing…

Grey Code
- 326
- 5
- 19
2
votes
1 answer
Why is Cocos2D update only firing when adding sprite to parent's CCSpriteBatchNode from child
I don't understand why the following is happening and I hope someones here can explain it.
I have a GameLayer (CCLayer) Class and a Food (CCNode) Class.
In the Gamelayer Class I create a bunch of food Objects that have a sprite as a property.
And I…

Ruben O
- 85
- 6
2
votes
1 answer
Cocos2d Spritesheet not loading (spriteWithSpriteFrameName)
I am a noob in cocos2d and learning as I develop. I read in cocos2d docs, and also from Ray Wenderlich tutorials, I tried to create spritesheet, but so far has been unable to load ANY of my sprites from the spritesheet I created. Sprites are showing…

GeneCode
- 7,545
- 8
- 50
- 85
1
vote
1 answer
How to display bounding box for sprites that are added to a CCSpriteBatchNode?
I have some sprites that I've added to a CCSpriteBatchNode. Everything shows up fine. Now I want to see their bounding boxes.
I've tried going into ccConfig and turning on CC_SPRITE_DEBUG_DRAW but all I get are white squares for everything: the…

iosdev69
- 11
- 1
1
vote
0 answers
CCSpriteBatchNode applying Shader?
I'm applying a shader to my BatchNode with cocos2d 2.0.
I updated the ccV3F_C4B_T2F struct to hold a new uniform, so it now looks like this:
typedef struct _ccV3F_C4B_T2F
{
ccVertex3F vertices;
ccColor4B colors; …

BigRed
- 79
- 10
1
vote
2 answers
Cocos2d-x: How to optimize memory from 100 same sprites?
My task is to draw one sprite 100 times in frame. For example I need to draw a row made of one sprite "sprite.png". I do it like this:
CCSprite *spriteArr[ 100 ];
for ( unsigned int i = 0; i < 100; i++ ) {
spriteArr[ i ] = new…

JavaRunner
- 2,455
- 5
- 38
- 52
1
vote
1 answer
Clip a CCSprite added to CCSpriteBatchNode
I'm clipping my sprite with this code:
//At my CCSprite subclass m.
-(void)visit
{
CGPoint worldOrg = [self convertToWorldSpace:ccp(0, 0)];
CGPoint dest = [self convertToWorldSpace:ccp(self.contentSize.width, self.contentSize.height)];
CGPoint dims…

Juan Ramirez
- 11
- 1
1
vote
1 answer
ccSpriteBatchNode child bounding box transformation
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,…
user1807754
1
vote
2 answers
How do I load a CCSpriteBatchNode from the documents directory?
I have a file in the documents directory that I verify does exist before I call this method:
CCSpriteBatchNode *batchNode = [[CCSpriteBatchNode alloc] initWithFile:filePath capacity:9];
The error reported is:
-[CCFileUtils…

TigerCoding
- 8,710
- 10
- 47
- 72
0
votes
0 answers
where exactly spritebatching and using spritesheet technique differs in draw calls and gpu processing?
I used to create games in cocos 2d engine and to optimise the draw calls,I use texture packer tool to make sprite sheets and using that i optimised draw calls,but later I saw approach called sprite batching.But in terms of draw calls both sprite…
0
votes
0 answers
How to bind alpha texture to SpriteBatchNode?
Can someone tell me how to bind alpha texture to SpriteBatchNode.
I have shader that use both textures alpha and origin. I extended Sprite and bind alpha texture to it and it works fine. But i don't understand how to bind texture to SpriteBatchNode…

Sufelfay
- 43
- 1
- 4
0
votes
1 answer
adding a normal CCSprite to CCSpriteBatchNode crashes
I am getting this exception in logs
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'CCSprite is not using the same texture id'
What I am trying to do is adding a normal "myfile.png" file to a…

jeet.chanchawat
- 5,842
- 5
- 38
- 59
0
votes
1 answer
How to resize the the animating sprite in cocos2d-x
I want to change the size of a Sprite which is animating. How can I do this ? I tried to change its size by using setScale property but it is not working here. where I am doing wrong ?
CCArray* frames =…

Ahmad dar
- 81
- 1
- 14