//plist文件中面有粒子效果的各种參数
//textureFileName相应着使用粒子的图片
auto particle = ParticleSystemQuad::create("starFlash.plist");
particle->setPosition(Vec2(s.width / 2, s.height / 2));
addChild(particle); //全部的配置也能够自己写
auto p2 = ParticleSystemQuad::createWithTotalParticles(200);
p2->setTexture(Director::getInstance()->getTextureCache()->addImage("CloseNormal.png"));
p2->setPosition(Vec2(100, 100));
// duration
p2->setDuration(ParticleSystem::DURATION_INFINITY); // radius mode
p2->setEmitterMode(ParticleSystem::Mode::RADIUS); // radius mode: start and end radius in pixels
p2->setStartRadius(4);
p2->setStartRadiusVar(1);
p2->setEndRadius(ParticleSystem::START_RADIUS_EQUAL_TO_END_RADIUS);
p2->setEndRadiusVar(0); // radius mode: degrees per second
p2->setRotatePerSecond(100);
p2->setRotatePerSecondVar(0); // angle
p2->setAngle(90);
p2->setAngleVar(0); // emitter position
auto size = Director::getInstance()->getWinSize();
p2->setPosVar(Point::ZERO); // life of particles
p2->setLife(0.5);
p2->setLifeVar(0); // spin of particles
p2->setStartSpin(0);
p2->setStartSpinVar(0);
p2->setEndSpin(0);
p2->setEndSpinVar(0); // color of particles
Color4F startColor(0.0f, 0.8f, 0.9f, 1.0f);
p2->setStartColor(startColor); Color4F startColorVar(0, 0, 0, 1.0f);
p2->setStartColorVar(startColorVar); Color4F endColor(1.0f, 1.0f, 1.0f, 0.1f);
p2->setEndColor(endColor); Color4F endColorVar(0, 0, 0, 0.1f);
p2->setEndColorVar(endColorVar); // size, in pixels
p2->setStartSize(20);
p2->setStartSizeVar(1);
p2->setEndSize(0); // emits per second
p2->setEmissionRate(p2->getTotalParticles() / p2->getLife()); // additive
p2->setBlendAdditive(false); //addChild(p2);
p2->setPosition(Point(200,200));
addChild(p2);

cocos2d-x 3.1.1 学习笔记[16] Particle 粒子效果的更多相关文章

  1. cocos2d-x 3.1.1 学习笔记[4]GridActions 网格动画

    文章写的  http://blog.csdn.net/zhouyunxuan 老样子.见代码. //GridActions can only used on NodeGrid auto nodeGri ...

  2. [XMPP]iOS聊天软件学习笔记[一]

    @import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...

  3. cocos2d-x 3.1.1学习笔记[23]寻找主循环 mainloop

    文章出自于  http://blog.csdn.net/zhouyunxuan cocos2d到底是怎样把场景展示给我们的,我一直非常好奇. 凭个人猜想,引擎内部的结构类似于这样 while(true ...

  4. cocos2d-x 3.1.1 学习笔记[3]Action 动作

    这些动画貌似都非常多的样子,就所有都创建一次. 代码例如以下: /* 动画*/ auto sp = Sprite::create("card_bg_big_26.jpg"); Si ...

  5. cocos2d-x 3.1.1 学习笔记[2]Sprite 精灵

    Sprite应该是用到最多的一个类吧.无法想像一个游戏没有精灵将怎样进行愉快的玩耍. Sprite继承于Node 和 TextureProtocol. Sprite是一个2d的图像. Sprite能够 ...

  6. cocos2d-x 3.1.1 学习笔记[21]cocos2d-x 创建过程

    文章出自于  http://blog.csdn.net/zhouyunxuan RootViewController.h #import <UIKit/UIKit.h> @interfac ...

  7. cocos2d-x 3.1.1 学习笔记[11] http请求 + json解析

    //http须要引入的头文件和命名空间 #include <network/HttpClient.h> using namespace network; //json须要引入的头文件 #i ...

  8. [XMPP]iOS聊天软件学习笔记[四]

    昨天完成了聊天界面,基本功能算告一段落 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework git clone https://githu ...

  9. [XMPP]iOS聊天软件学习笔记[三]

    今天做了好友界面,其实xmpp内部已经写好很多扩展模块,所以使用起来还是很方便的 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework gi ...

随机推荐

  1. Android开发初体验

    本文通过开发一个应用来学习Android基本概念及构成应用的UI组件. 开发的应用名叫GeoQuiz,它能给出一道道地理知识问题.用户点击true或false按钮回答问题,应用即时做出反馈 第一步请先 ...

  2. 【sqli-labs】 less47 GET -Error based -String -Order By Clause(GET型基于错误的字符型Order By从句注入)

    http://192.168.136.128/sqli-labs-master/Less-47/?sort=1 改变sort的值,结果仍然是order by 1的结果 http://192.168.1 ...

  3. Eclipse中自动生成get/set时携带注释给get/set

    Eclipse中自动生成get/set时携带注释给get/set   编码的时候通常要用到 JavaBean ,而在我们经常把注释写在字段上面,但生成的Get/Set方法不会生成,通过修改Eclips ...

  4. 中望CAD VBA检测文件是否存在

    Option Explicit Private Declare Function PathFileExists Lib "shlwapi.dll" Alias "Path ...

  5. mysql异地备份方案经验总结

    Mysql 数据库异地备份脚本 实验环境:关闭防火墙不然不能授权登录 Mysql-server:192.168.30.25 Mysql-client:  192.168.30.24 实验要求:对mys ...

  6. C++入职学习篇--新员工入职(持续更新)

    C++入职学习篇--新员工入职(持续更新) 本人菜鸟一枚,刚刚结束学业生涯,入职C++软件开发岗位,之前对C++一窍不通,刚刚入职,亚历山大,但为祖国和平发展,本人励志为中华崛起而奋斗,学不好C++誓 ...

  7. 求n!(高精度问题)

    #include <iostream> #include <stdio.h> #define MAX 10000 using namespace std; void Mul(i ...

  8. Django View(视图系统)

    Django View 官方文档 一个视图函数(类),简称视图,是一个简单的 Python 函数(类),它接受Web请求并且返回Web响应.响应可以是一张网页的HTML内容,一个重定向,一个404错误 ...

  9. 一篇入门Node.js

    目录 1.Node.js 简介 2.Node.js NPM 3.Node.js 模块 4.Node.js 事件 5.Node.js Buffer 6.Node.js 文件系统 7.Node.js St ...

  10. Spring MVC 单元测试Demo

    @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(locations={" ...