cocos2d-x 3.1.1 学习笔记[16] Particle 粒子效果
//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 粒子效果的更多相关文章
- cocos2d-x 3.1.1 学习笔记[4]GridActions 网格动画
文章写的 http://blog.csdn.net/zhouyunxuan 老样子.见代码. //GridActions can only used on NodeGrid auto nodeGri ...
- [XMPP]iOS聊天软件学习笔记[一]
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...
- cocos2d-x 3.1.1学习笔记[23]寻找主循环 mainloop
文章出自于 http://blog.csdn.net/zhouyunxuan cocos2d到底是怎样把场景展示给我们的,我一直非常好奇. 凭个人猜想,引擎内部的结构类似于这样 while(true ...
- cocos2d-x 3.1.1 学习笔记[3]Action 动作
这些动画貌似都非常多的样子,就所有都创建一次. 代码例如以下: /* 动画*/ auto sp = Sprite::create("card_bg_big_26.jpg"); Si ...
- cocos2d-x 3.1.1 学习笔记[2]Sprite 精灵
Sprite应该是用到最多的一个类吧.无法想像一个游戏没有精灵将怎样进行愉快的玩耍. Sprite继承于Node 和 TextureProtocol. Sprite是一个2d的图像. Sprite能够 ...
- cocos2d-x 3.1.1 学习笔记[21]cocos2d-x 创建过程
文章出自于 http://blog.csdn.net/zhouyunxuan RootViewController.h #import <UIKit/UIKit.h> @interfac ...
- cocos2d-x 3.1.1 学习笔记[11] http请求 + json解析
//http须要引入的头文件和命名空间 #include <network/HttpClient.h> using namespace network; //json须要引入的头文件 #i ...
- [XMPP]iOS聊天软件学习笔记[四]
昨天完成了聊天界面,基本功能算告一段落 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework git clone https://githu ...
- [XMPP]iOS聊天软件学习笔记[三]
今天做了好友界面,其实xmpp内部已经写好很多扩展模块,所以使用起来还是很方便的 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework gi ...
随机推荐
- SAS进阶《深入解析SAS》之Base SAS基础、读取外部数据到SAS数据集
SAS进阶<深入解析SAS>之Base SAS基础.读取外部数据到SAS数据集 前言:在学习完<SAS编程与商业案例>后,虽然能够接手公司的基本工作,但是为了更深入的SAS学习 ...
- Android 从服务器获取时间戳转换为年月日
用JAVA相关类转换.代码如下: Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(NumberUtils.ge ...
- Hive扩展功能(三)--使用UDF函数将Hive中的数据插入MySQL中
软件环境: linux系统: CentOS6.7 Hadoop版本: 2.6.5 zookeeper版本: 3.4.8 主机配置: 一共m1, m2, m3这五部机, 每部主机的用户名都为centos ...
- C#连接Sqlite 出现:混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集。的解决方案
C#连接Sqlite 出现: 混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集.的解决方案 C#连接sqlite数据库代码 ...
- asp.net MVC 下拉多级联动及编辑
多级联动实现,附源码.当前,部分代码是参与博客园其它网友. 新增,前台代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 ...
- python编辑csv
import csv import time def timestamp_to_timestr(timeStamp): timeArray = time.localtime(int(timeStamp ...
- php字符串无乱码截取函数封装
/** * * 中英混合字符串长度判断 * @param unknown_type $str * @param unknown_type $charset */ function strLength( ...
- SpringMVC参数绑定、Post乱码解决方法
从客户端请求key/value数据,经过参数绑定,将key/value数据绑定到controller方法的形参上. springmvc中,接收页面提交的数据是通过方法形参来接收.而不是在control ...
- Qt Creator 中文乱码问题
一. Qt 4 乱码问题 解决方案 1. 在Qt 中 快捷菜单选项功能中 Edit(编辑) --> Select Encoding...(选择编码) 选择载入(显示)编码和储存编码,要解决中文 ...
- HDU114 - Piggy-Bank 【完全背包】
在 ACM 能够开展之前,必须准备预算,并获得必要的财力支持.该活动的主要收入来自于 Irreversibly Bound Money (IBM).思路很简单.任何时候,某位 ACM 会员有少量的钱时 ...