cocos2d-3.2 逐帧动画播放
动画实现的基本流程: 1.定义向量保存动画的所有帧 Vector<SpriteFrame *> allframe; for(int i=1;i<10;i++) { SpriteFrame * sf=SpriteFrame::create( StringUtils::format("run%d.png",i), Rect(0,w,h) ); allframe.pushBack(sf); } 2.创建动画 Animation * animation01=Animation::createWithSpriteFrames(allframe); animation01->setDelayPerUnity(0.3); 3.创建动作 Animate *animate01=Animate::create(animation01); 4.包装动作 Action * act=RepeatForEver::create(animate01); 5.让一个Sprite执行动作 Sprite * sp=Sprite::create(); sp->runAction(act); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |