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/ ...
随机推荐
- es6-块级作用域let 和 var的区别
块级绑定 js的处理机制和我们大家想象的完全不同,并不完全是所谓函数调用以及上下执行那样简单,它是存有”域”的本质区别的. var具有全局污染特性,所以es6才会出现let .const. 下面通过一 ...
- ADS中编译现存项目时常见错误:无法打开文件\…\…\2440init.o的解决办法
错误提示如下: 解决方法: 重新编译即可.
- jquery.dataTables动态列
jquery.dataTables 版本1.10.7 直接上代码: 0.table <table id="popReportTable"> <thead> ...
- Loader拉取图片,由于redirect重定向,导致策略文件无效 设置checkPolicyFile后还是无效:需要一个策略文件,但在加载此媒体时未设置 checkPolicyFile 标志
大家好,在这里分享一下flash里边处理redirect的方法. 一般而言,大家不会遇到这个问题,毕竟图片地址一般杠杠的,不会redirect.但昨天在拉取空间的照片就会出现redirect.神啊!! ...
- webservice系统学习笔记6-使用soap的header传递消息
1.显示的使用soap的header传递消息(不推荐使用,会破坏正常的代码结构,推荐使用handler处理) @WebResult(name="deleteResult") pub ...
- windows执行命令来运行loadrunner录制好的脚本(收藏)
SET M_ROOT=D:Mercury InteractiveMercury LoadRunnerincd %M_ROOT% wlrun.exe -TestPath D:ceshi10Scenari ...
- oracle默认连接数150
当oracle连接数超过最大的150登录不上 sqlplus / as sysdba ###报错,提示连接数未释放! ---释放网络连接数 ps -ef |grep ora |grep " ...
- 使用Nginx限制同一IP的访问频率
http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html http://nginx.org/en/docs/http/ngx_http ...
- android上进行c/C++开发测试(转)
Android C编程技巧 运行模拟器 emulator -console * 将文件写入到模拟器的userdata.img文件中 adb push *将一个目录拷贝到模拟器中,包括子目录 adb p ...
- 小程序四:视图之WXSS
WXSS(WeiXin Style Sheets)是MINA设计的一套样式语言,用于描述WXML的组件样式. WXSS用来决定WXML的组件应该怎么显示. 为了适应广大的前端开发者,我们的WXSS具有 ...