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/ ...
随机推荐
- java实现内部排序算法
冒泡排序 public class BubbleSort{ public static int[] asc(int[] a){ int item; for (int i = 0; i < a.l ...
- hdu4490 Mad Veterinarian(bfs)
Mad Veterinarian Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 关于zookeeper的自我解惑
分布式服务框架 Zookeeper -- 管理分布式环境中的数据: http://www.ibm.com/developerworks/cn/opensource/os-cn-zookeeper/ ...
- 〖Linux〗build sqlite3 for Arm
Version: sqlite-autoconf-3080100.tar.gz Download: https://www.sqlite.org/download.html 1. toolchains ...
- python之函数用法__getitem__()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法__getitem__() #http://www.cnblogs.com/hongf ...
- python一键电影搜索与下载
代码地址如下:http://www.demodashi.com/demo/14313.html python一键电影搜索与下载 概述 使用python搜索并爬取豆瓣电影信息,包括评分,主演,导演,类型 ...
- oracle-imp导入小错filesize设置
***********************************************声明*************************************************** ...
- ios block常见的错误(一)
Block是OC中的一种数据类型,在iOS开发中被广泛使用. 在实际的使用和面试过程中,经常发现同事或面试者对block了解得不够透彻,本博文将列举常见block错误来对其加深理解. 示例代码1: ; ...
- StringBuilder.AppendFormat(String, Object, Object) 方法
将通过处理复合格式字符串(包含零个或零个以上格式项)返回的字符串追加到此实例. 每个格式项都替换为这两个参数中任意一个参数的字符串表示形式. 说明: public StringBuilder Appe ...
- 越狱iphone在cydia下插件后出现exit safe mode肿么办小教程
http://bbs.app111.com/thread-318898-1-1.html 从简单的开始..最简单的点击状态栏会弹出来一个窗口,那窗口有三个选择请选择第二个,然后等待它重启,重启后还没消 ...