首页 > 代码库 > cocos2dx3.2几种特效的显示方式
cocos2dx3.2几种特效的显示方式
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("CoinEffectFrame.plist"); log("CoinEffectFrame.plist"); Array *animations = Array::createWithCapacity(8); char str[100]={0}; Animation* animation = Animation::create(); for(int i = 0;i< 8;i++) { sprintf(str,"coineffect-EffectIn%d.png",i); log(str); animation->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(str)); } animation->setDelayPerUnit(0.2f); AnimationCache::sharedAnimationCache()->addAnimation(animation,"dance"); //cocosbuilder::CCBReader * ccbReader = new cocosbuilder::CCBReader(NodeLoaderLibrary::newDefaultNodeLoaderLibrary()); // auto node = ccbReader->readNodeGraphFromFile("CoinEffectFrame.ccbi"); // ccbReader->release(); //addChild(node); //node->setPosition(100 ,200); spAtlas* atlas = spAtlas_createFromFile("coineffect.atlas", 0); spSkeletonJson* json = spSkeletonJson_create(atlas); json->scale = 1; spSkeletonData* skeletonData = http://www.mamicode.com/spSkeletonJson_readSkeletonDataFile(json,"coineffect.json"); long first = Function::getInstance()->getTimeuSec(); auto skeletonCoinNode = spine::NEWSkeletonAnimation::createWithData(skeletonData); skeletonCoinNode->setAnimation(0, "EffectIn", false); skeletonCoinNode->setPosition(100, 200); addChild(skeletonCoinNode); long first2 = Function::getInstance()->getTimeuSec(); auto skeletonCoinNode1 = spine::NEWSkeletonAnimation::createWithData(skeletonData); skeletonCoinNode1->setAnimation(0, "EffectIn", false); skeletonCoinNode1->setPosition(200, 300); addChild(skeletonCoinNode1); auto skeletonCoinNode2 = spine::NEWSkeletonAnimation::createWithData(skeletonData); skeletonCoinNode2->setAnimation(0, "EffectIn", false); skeletonCoinNode2->setPosition(300, 400); addChild(skeletonCoinNode2); /*Animation* animation1 = AnimationCache::sharedAnimationCache()->animationByName("dance"); animation1->setRestoreOriginalFrame(true); Animate *action = Animate::create(animation1); auto sprite = Sprite::create(); addChild(sprite); sprite->setPosition(100, 200); sprite->runAction(action); long first2 = Function::getInstance()->getTimeuSec(); Animation* animation2 = AnimationCache::sharedAnimationCache()->animationByName("dance"); animation2->setRestoreOriginalFrame(true); Animate *action2 = Animate::create(animation1); auto sprite2 = Sprite::create(); addChild(sprite2); sprite2->setPosition(200, 300); sprite2->runAction(action2);*/ log("time[%ld][%ld]", first2 - first, Function::getInstance()->getTimeuSec() - first2);//log("time[%ld]", Function::getInstance()->getTimeuSec() - first);
cocos2dx3.2几种特效的显示方式
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。