voID HelloWorld::mcallBack(CCObject *pSend){ CCSprite *pSpr = (CCSprite *)pSend; pSpr->removeFromParentAndCleanup(true);}bool HelloWorld::cctouchBegan(CCtouch *ptouch,CCEvent *pEvent){ cclOG(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); CCPoint pt = ptouch->getLocation(); CCSpriteFrameCache *cache = CCSpriteFrameCache::sharedSpriteFrameCache(); cache->addSpriteFramesWithfile("frame_ani/pointer.pList","frame_ani/pointer.png"); CCSprite *light = CCSprite::create(); light->setposition(pt); this->addChild(light); CCArray *spriteArray = CCArray::create(); char str[100] = { 0 }; for (int i = 1; i <= 9; i++) { sprintf(str,"pointer/%02d.png",i); CCSpriteFrame *frame = cache->spriteFrameByname(str); spriteArray->addobject(frame); } CCAnimation *animation = CCAnimation::createWithSpriteFrames(spriteArray,0.05f); CCAnimate *animate = CCAnimate::create(animation); CCFiniteTimeAction *actSeq = CCSequence::create(animate,CCCallFuncO::create(this,callfuncO_selector(HelloWorld::mcallBack),light),NulL); light->runAction(actSeq); return true;}总结
以上是内存溢出为你收集整理的Cocos2d-x_播放帧动画全部内容,希望文章能够帮你解决Cocos2d-x_播放帧动画所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)