我的环境中有四种不同类型的对象(box2d),每种类型的对象都有自己的多个实例,并且希望找到处理添加和操作所有 CCSprite 的最有效方法。精灵都来自不同的文件,所以最好是创建每个精灵并将其添加到数据结构(NSMutableArray)中,还是即使每个 CCSprite 文件不同(对于每种类型的对象),我也会使用 CCSpriteBatchNode?谢谢。
@interface LevelScene : CCLayer
{
b2World* world;
GLESDebugDraw *m_debugDraw;
CCSpriteBatchNode *ballBatch;
CCSpriteBatchNode *blockBatch;
CCSpriteBatchNode *springBatch;
CCSprite *goal;
}
+(id) scene;
// adds a new sprite at a given coordinate
-(void) addNewBallWithCoords:(CGPoint)p;
// loads the objects (blocks, springs, and the goal), returns the Level Object
-(Level) loadLevel:(int)level;
@end