cocos2dx自学之 动作特效与场景切换特效

前端之家收集整理的这篇文章主要介绍了cocos2dx自学之 动作特效与场景切换特效前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

直接上 示例代码


//抖动特效
	/*auto role=NodeGrid::create();
	role->addChild(Sprite::create("HelloWorld.png"));
	role->setPosition(visibleSize/2);
	addChild(role);*/
	//抖动特效 参数1是抖动时间 参数3是抖动程度
	//role->runAction(Shaky3D::create(10,Size(50,50),5,false));
	//网格特效 size :切割50X50块  5:执行5秒
	//role->runAction(ShakyTiles3D::create(10,false));
	//爆炸特效  参数1是爆炸时间 其余未知
	//role->runAction(ShuffleTiles::create(1,5));
	//顺序执行先抖动再爆炸效果
	/*auto doudong = Shaky3D::create(1,10,false);
	auto baozha = ShuffleTiles::create(1,5);
	role->runAction(Sequence::create(doudong,baozha,NULL));*/
	//碎片消失效果
	//role->runAction(TurnOffTiles::create(1,25));
	//波纹效果
	//role->runAction(Waves3D::create(2,Size(15,10),40));
	//波纹效果执行完毕后恢复原来效果
	/*auto w1 = Waves3D::create(2,40);
	auto w2 = Waves3D::create(2,0);
	role->runAction(Sequence::create(w1,w2,NULL));*/

	/***************************************场景切换特效**************************************/
	/*auto background = Sprite::create("bg.jpg");
	background->setPosition(visibleSize/2);
	addChild(background);
	//创建文字
	/*LabelTTF *label = LabelTTF::create("more eat with the shit!Dou Bi Song!","Consolas",40);
	label->setPosition(visibleSize.width / 2,visibleSize.height / 2);
	addChild(label);*/

	/*scheduleOnce([visibleSize](float f){
		auto newScene = Scene::create();
		auto newBackground = Sprite::create("bg2.jpg");
		newBackground->setPosition(visibleSize/2);
		newScene->addChild(newBackground);
		//创建特效
		//auto t = TransitionCrossFade::create(1,newScene); //淡出切换效果
		//auto t = TransitionZoomFlipAngular::create(1,newScene);//反转特效
		//auto t = TransitionPageTurn::create(1,newScene,false);//翻页特效 true and false切换不同翻页特效
		//auto t = TransitionProgressRadialCW::create(1,newScene); //顺时针特效
		auto t = TransitionSplitRows::create(1,newScene);//拆分特效
		Director::getInstance()->replaceScene(t);//执行特效   
	},2,"Test");*/
原文链接:https://www.f2er.com/cocos2dx/342112.html

猜你在找的Cocos2d-x相关文章