Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the best approach for CCSpriteBatchNode and texture sheets in a Cocos2D game scene
    primarykey
    data
    text
    <p>I am modifying some tutorials I found on <a href="http://www.apress.com/9781430233039/" rel="nofollow noreferrer">Learn Cococs2D</a> and found that whenver I use more than one CCSpriteBatchNode in one class the frame rate drops. </p> <p>Reading a bit around I understood that one CCSpriteBatchNode can accept only 1 texture sheet at a time and this poses some limitations on the level design (sprite sheet can be max 2048x2048 pixels <a href="https://stackoverflow.com/questions/7549266/when-to-use-ccspritebatchnode">discussion</a>). Although there are some extensions that seem to overcome this limitaton (which I haven't yet dared to try) <a href="https://github.com/cocos2d/cocos2d-iphone-extensions/tree/master/Extensions/CCBigImage" rel="nofollow noreferrer">CCBigImage</a>.</p> <p>I am trying to following the one file approach and load all my images in one CCSpriteFrameCache but I haven't found much on <a href="http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:best_practices" rel="nofollow noreferrer">programming guides</a> about this. </p> <p>In the ShootEmUp example of <a href="http://www.apress.com/9781430233039/" rel="nofollow noreferrer">1</a> the approach is to have a CCSpriteBatchNode in ParallaxNode as well as in other classes such as EnemyCache (find source on folder Chapter 8 on link <a href="http://www.apress.com/downloadable/download/sample/sample_id/640/" rel="nofollow noreferrer">book source code link</a>)</p> <p>Although I have researched a bit on the cocos2d-iphone.org forums and found the following topic where a <strong>moderator suggests to add only one instance of CCSpriteBatchNode to the root layer</strong> <a href="http://www.cocos2d-iphone.org/forum/topic/16827" rel="nofollow noreferrer">forum topic</a>.</p> <p><strong>I am now a bit confused</strong>. The one thing I noticed is that following the <a href="http://www.apress.com/9781430233039/" rel="nofollow noreferrer">1</a> approach (multiple instances) the frame rate is not optimal. Have you similar experiences and how do you tackle this? </p> <p><strong>Multiple CCSpriteBatchNode or not? One texture sheet per level or multiple?</strong></p> <p>Thanks a lot for reading :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload