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/ ...
随机推荐
- Hibernate(八)多对多映射
一.创建数据表 --学生证表 create table paper ( pid number primary key, pdesc ) , sid number references student( ...
- Java从零开始学三十三(JAVA IO- File类)
一.简述 在整个io包中,唯一表示与文件本身有关的类就是File类.使用File类可以进行创建或删除文件等常用操作.要想使用File类,则首先要观察File类的构造方法,此类的常用构造方法如下所示: ...
- Fiddler Session标志
Each Session object in Fiddler contains a collection of string flags, in the Session.oFlags[] collec ...
- ORA-14300: 分区关键字映射到超出允许的最大分区数的分区
环境为:Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production 对象表为按天的自动分区表: PARTI ...
- Flash:DisplayObject的矩阵旋转(移动/修改注册点,修改旋转点)
简单来说,原理就是利用matrix运算,先把旋转点移到原点位置,旋转变换后再恢复到原来的位置 var a:Sprite = new Sprite(); a.graphics.beginFill(0); ...
- 〖Linux〗VIM youcompleteme 自动补全 #include 文件名称
1. 拷贝配置文件 cp ~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py ~/.vim/.ycm_extra_conf.py 2. 修改配 ...
- python中的多态
# -*- coding: cp936 -*- #python 27 #xiaodeng #python中的多态 #多态:一个操作的意义取决于被操作对象的类型,相同的消息给予不同的对象会引发不同的动作 ...
- js出现Syntax error on token "catch", Identifier expected
本文转自:http://blog.csdn.net/u011159417/article/details/73916676 项目中需要使用jQuery,因此下载了jQuery的js包jquery-3. ...
- 用Python实现BP神经网络(附代码)
用Python实现出来的机器学习算法都是什么样子呢? 前两期线性回归及逻辑回归项目已发布(见文末链接),今天来讲讲BP神经网络. BP神经网络 全部代码 https://github.com/lawl ...
- linux下socket编程常用头文件
sys/types.h:数据类型定义 sys/socket.h:提供socket函数及数据结构netinet/in.h:定义数据结构sockaddr_inarpa/inet.h:提供IP地址转换函数n ...