Cocos2d-x_播放帧动画

Cocos2d-x_播放帧动画,第1张

概述void HelloWorld::mcallBack(CCObject *pSend){ CCSprite *pSpr = (CCSprite *)pSend; pSpr->removeFromParentAndCleanup(true);}bool HelloWorld::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent){ CCLOG(
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_播放帧动画所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1051445.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存