CCMotionStreak(一)
void MotionStreakTest1::onEnter()
{
MotionStreakTest::onEnter(); CCSize s = CCDirector::sharedDirector()->getWinSize(); // the root object just rotates around
m_root = CCSprite::create(s_pPathR1);
addChild(m_root, );
m_root->setPosition(ccp(s.width/, s.height/)); // the target object is offset from root, and the streak is moved to follow it
m_target = CCSprite::create(s_pPathR1);
m_root->addChild(m_target);
m_target->setPosition(ccp(s.width/, )); // create the streak object and add it to the scene
streak = CCMotionStreak::create(, , , ccGREEN, s_streak);
addChild(streak);
// schedule an update on each frame so we can syncronize the streak with the target
schedule(schedule_selector(MotionStreakTest1::onUpdate)); CCActionInterval* a1 = CCRotateBy::create(, ); CCAction* action1 = CCRepeatForever::create(a1);
CCActionInterval* motion = CCMoveBy::create(, ccp(,) );
m_root->runAction( CCRepeatForever::create((CCActionInterval*)(CCSequence::create(motion, motion->reverse(), NULL)) ) );
m_root->runAction( action1 );
//最后的颜色会跟背景色一致,这样就达到逐渐消失的效果
CCActionInterval *colorAction = CCRepeatForever::create((CCActionInterval *)CCSequence::create(
CCTintTo::create(0.2f, , , ),
CCTintTo::create(0.2f, , , ),
CCTintTo::create(0.2f, , , ),
CCTintTo::create(0.2f, , , ),
CCTintTo::create(0.2f, , , ),
CCTintTo::create(0.2f, , , ),
CCTintTo::create(0.2f, , , ),
NULL)); streak->runAction(colorAction);
} void MotionStreakTest1::onUpdate(float delta)
{
//先获取精灵m_target左上角的坐标,然后赋值给streak,m_target的坐标一直在变化
streak->setPosition( m_target->convertToWorldSpace(CCPointZero) );
}
CCMotionStreak(一)的更多相关文章
- cocos2d-x之CCMotionStreak类——2013-08-25 16
在游戏的实现过程中,有时会需要在某个游戏对象上的运动轨迹上实现渐隐效果.这种感觉就好像是类似飞机拉线的拖尾巴,在视觉上感觉很好,比如子弹的运动轨迹等,如果不借助引擎的帮助,这种效果往往需要通过大量 ...
- cocos2dx 以子弹飞行为例解说拖尾效果类CCMotionStreak
在游戏开发中,有时会须要在某个游戏对象上的运动轨迹上实现渐隐效果.比方子弹的运动轨迹,假设不借助引擎的帮助,这样的效果则须要通过大量的图片来实现.而Cocos2D-x的拖动渐隐效果类CCMotionS ...
- cocos2dx 子弹飞作为一个例子来解释解酒效果类CCMotionStreak
感谢点评与关注,欢迎转载与分享. 勤奋努力,持之以恒! 在游戏开发中,有时会须要在某个游戏对象上的运动轨迹上实现渐隐效果.比方子弹的运动轨迹,假设不借助引擎的帮助.这样的效果则须要通过大量的图片来实现 ...
- SpriteBuilder中CCMotionStreak坐标类型不匹配
在SpriteBuilder需要被跟随的(或是说被拖尾的)节点坐标类型是父百分比,先是将CCMotionStreak本身位置设置为百分比类型,但是无效. 将节点坐标改为正常点类型后,MotionStr ...
- SpriteBuilder中CCMotionStreak提示图片文件找不到
今天写代码时遇到上述问题,代码如下: player.streak = [CCMotionStreak streakWithFade:3.f minSeg:1 width:30 color:[CCCol ...
- [Cocos2d-x For WP8]MotionStreak拖尾效果
拖尾效果是指在在游戏中,一个精灵在运动的过程中会留下一个短暂的轨迹效果,在游戏里面如打斗的特效往往会需要用到这种效果来给运动的增加绚丽的效果.那么在Cocos2D-x里面我们可以使用一种内置的拖动渐隐 ...
- cocos2d-x 2.0 拖尾效果分析
转自:http://game.dapps.net/gamedev/game-engine/7281.html 在Cocos2d-x中,拖尾效果有一个专门的类CCMotionStreak来实现.下面我们 ...
- cocos2d-x学习笔记
转自:http://blog.csdn.net/we000636/article/details/8263503 接受触屏事件的优先级是值越小,响应触屏事件的优先级越高 Z值越大,越外面 JNI:允许 ...
- 【转】Cocos2d-x 2.0 拖尾效果深入分析
Cocos2d-x 2.0 拖尾效果深入分析 另:本章所用Cocos2d-x版本为: cocos2d-2.0-x-2.0.2@ Aug 30 2012 http://cn.cocos2d-x.org/ ...
随机推荐
- CentOS(学习笔记一)
菜鸟记录 一.配置网络.防火墙等 setup命令 二.查看网络 ifconfig 重启网络 /ect/init.d/network restart 或者ifup ethx(,,)等 查看网络配置文件 ...
- MySQL 导出函数与存储过程
C:\Users\yan>mysqldump -u用户 -p -n -t -d -R 数据库 > .sql Enter password: ******** C:\Users\yan> ...
- php如何实现页面跳转
•PHP页面跳转一.header()函数 header()函数是PHP中进行页面跳转的一种十分简单的方法.header()函数的主要功能是将HTTP协议标头(header)输出到浏览器. header ...
- ipa 打包遇到的坑
1.xcode 打包 并上传至 appstore 审核 2.预留邮箱 收取 appstore 的审核结果 3.审核通过以后,通过 iTunes Connect 上传正式文件至 appstore ...
- 玩转Android Camera开发(四):预览界面四周暗中间亮,仅仅拍摄矩形区域图片(附完整源代码)
杂家前文曾写过一篇关于仅仅拍摄特定区域图片的demo.仅仅是比較简陋.在坐标的换算上不是非常严谨,并且没有完毕预览界面四周暗中间亮的效果,深以为憾.今天把这个补齐了. 在上代码之前首先交代下,这里面存 ...
- Java Lombok 减少代码冗余 get set
1.下载 2.安装 java -jar Users\uatww990393\Desktop\lombok-1.16.16.jar a. 直接添加jar包到lib中 在java中项目中使用lombok ...
- eclipse to avoid the message, disable the...
标题 CreateTime--2018年5月9日10:38:15 Author:Marydon 1.问题描述 2.问题解析 这是因为eclipse的智能提示超时引起的,将超时间调大即可,如:200 ...
- SettingsPLSQLDeveloper
迁移时间:2017年5月21日10:12:23Author:Marydon 一.常用配置项UpdateTime--2017年3月15日13:55:46注:没有安装Oracle数据库的情况下,前两步 ...
- 1个比较简单的使用java反射机制获取前台数据进行数据封装的例子
//利用反射机制 和 从request获取所有参数的形式来构建查询对象 CustomerChooseSearchParma searchObject = new CustomerChooseSearc ...
- web.config配置数据库连接(转)
摘自:http://www.cnblogs.com/breezeblew/archive/2008/05/01/1178719.html 第一种: 取连接字符串 string connString = ...