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/ ...
随机推荐
- cocos2d 重写顶点着色语言
bool CCShaderSprite::initWithFile( const char *pszFilename ) { bool ret=false; do { ret=CCSpri ...
- TCP协议为什么会采用三次握手,若采用二次握手可以吗?
TCP(Transmission Control Protocol 传输控制协议)是一种面向连接(连接导向)的.可靠的.基于IP的传输层协议,采用三次握手确认建立一个连接. TCP为了保证报文传输的 ...
- Codeforces Round #228 (Div. 1) C 贪心
嘎嘎,今天被一些事耽误了,可是还是A了几个题目,这道题还不错 题目链接: 题意:两个人玩游戏,有N堆纸牌,纸牌上有数字,A每次仅仅能取N堆中的 当中一个的顶部的 纸牌,B仅仅能取N堆中的当中一个底部 ...
- Oracle查询备注信息
查询表的备注信息: SELECT TABLE_NAME, TABLE_TYPE, COMMENTS FROM USER_TAB_COMMENTS WHERE TABLE_NAME = 'MR_DEPT ...
- svn,git,scp,rsync,rake,ssh,wget,axel,aria2,nohup,grep,tail,siege,mitmproxy,ulimit,netstat,lsof
scp 把本地文件上传到server上 scp -P 1234 config/cert/dev/client.pem dev@xx.xxx.xxx:/srv/rorapps/fgcc/config/c ...
- HDUOJ---2546 饭卡
饭卡 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submissi ...
- sudo: Cannot execute /usr/local/bin/zsh: No such file or directory 问题
参考:sudo: Cannot execute /usr/local/bin/zsh: No such file or directory 之前在美化Ubuntu的时候,下了个zsh,但是忘记改配置文 ...
- shell 编程之2>&1含义
http://blog.csdn.net/gyanp/article/details/7258356 经常可以在一些脚本,尤其是在crontab调用时发现如下形式的命令调用 /tmp/test.sh ...
- 利用pushState开发无刷页面切换(转)
相关文档:https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulatingthebrowser_history 实现目标 ...
- python webdriver API学习笔记
浏览器操作 driver.maximize_window() #浏览器最大化 driver.set_window_size(480,800) #设置浏览器宽,高 driver.back() & ...