CCSprite vs ?

CCSprite vs ?
0.0 0


Hi there
Forgive me the question, but I am new to cocos2d.
I tried demo games, that are using CCSprite.
However I think CCSprite is to much for simpler task like building the background screen for a scene.
Sprites are meant to be moved, detecting collisions, etc.
I want to build screen from elements, that will not be moved through all the action.
Is there some other object that would be more suitable for displaying graphics ?



Hi, Pawel.
In cocos2d-x sprites are not detect collisions by-default. All classes that could be placed on scene are derived from CCNode - and they all can to be moved, animated and other things because CCNode has such abilities.


Thanks for your response.
What I need is a method for building a background from elements, that are drawn only at the beginning, will not be moved, just stay there.
Creating sprite takes memory.
I am not sure how does it work inside Cocos2d, but creating so many objects just to draw the screen seems not memory efficient.
Is there better method for drawing kind of matrix from library blocks ?


In each tick there will be redraw of all the current scene elements, so feel free to use CCSprite for your needs.
If there is an image on your screen, it takes memory for it’s pixels. If you talking about overhead because of member variables of CCSprite - it small enough to forget about it.
If there are a many identical blocks, you could use CCSpriteBatchNode, refer to:


Thanks, I got it now.
I thought there is a screen memory, that keeps graphic, so drawing and keeping the graphic in memory would be a waste of memory.
But if everything is redrawn every frame, keeping every object in memory makes sense.
Thanks for the hint about CCSpriteBatchNode, it clears my next question I had.