如题:在cocos2d/x中,如果每一帧都由几个module块组成的,该怎么组织框架结,也就是j2me时代的动作编辑方式.
CCTexture2D*texture=CCTextureCache::sharedTextureCache()->addImage("dragon.png"); CCSpriteBatchNode*sheet=CCSpriteBatchNode::createWithTexture(texture, 10); this->addChild(sheet,0,kTagSpriteSheet); CCSize s=CCDirector::sharedDirector()->getWinSize(); flyActionArray=new CCArray; CCArray*animFrames=new CCArray; for (int i=0; i<8; i++) { for (int j=0; j<10; j++) { CCSpriteFrame*frame=CCSpriteFrame::createWithTexture(texture, CCRectMake(j*75, i*70, 75, 70)); animFrames->addObject(frame); } CCAnimation *animation=CCAnimation::createWithSpriteFrames(animFrames,0.1f); CCAnimate* animate=CCAnimate::create(animation);
CCSequence*seq=(CCSequence*)CCSequence::create(animate,NULL); animFrames->removeAllObjects(); this->flyAction=CCRepeatForever::create(seq); flyActionArray->addObject(flyAction);
} CCSpriteFrame*frame1=CCSpriteFrame::createWithTexture(texture, CCRectMake(0, 0, 75, 70)); this->dragon=CCSprite::createWithSpriteFrame(frame1); dragon->setPosition(ccp(s.width/2-80, s.height/2)); sheet->addChild(dragon); this->flyAction=(CCAction*)flyActionArray->objectAtIndex(0); dragon->runAction(flyAction);
很显然这种方式是不行的了!