动作基类 CCAction

CCAction动作基类关系
class CC_DLL CCAction : public CCObject
{
public:
CCAction(void);
virtual ~CCAction(void); const char* description(); virtual CCObject* copyWithZone(CCZone *pZone); //! return true if the action has finished
virtual bool isDone(void); //! called before the action start. It will also set the target.
virtual void startWithTarget(CCNode *pTarget); /**
called after the action has finished. It will set the 'target' to nil.
IMPORTANT: You should never call "[action stop]" manually. Instead, use: "target->stopAction(action);"
*/
virtual void stop(void); //! called every frame with it's delta time. DON'T override unless you know what you are doing.
virtual void step(float dt); /**
called once per frame. time a value between 0 and 1 For example:
- 0 means that the action just started
- 0.5 means that the action is in the middle
- 1 means that the action is over
*/
virtual void update(float time); inline CCNode* getTarget(void) { return m_pTarget; }
/** The action will modify the target properties. */
inline void setTarget(CCNode *pTarget) { m_pTarget = pTarget; } inline CCNode* getOriginalTarget(void) { return m_pOriginalTarget; }
/** Set the original target, since target can be nil.
Is the target that were used to run the action. Unless you are doing something complex, like CCActionManager, you should NOT call this method.
The target is 'assigned', it is not 'retained'.
@since v0.8.2
*/
inline void setOriginalTarget(CCNode *pOriginalTarget) { m_pOriginalTarget = pOriginalTarget; } inline int getTag(void) { return m_nTag; }
inline void setTag(int nTag) { m_nTag = nTag; } public:
/** Create an action */
static CCAction* create();
protected:
CCNode *m_pOriginalTarget;
/** The "target".
The target will be set with the 'startWithTarget' method.
When the 'stop' method is called, target will be set to nil.
The target is 'assigned', it is not 'retained'.
*/
CCNode *m_pTarget;
/** The action tag. An identifier of the action */
int m_nTag;
};

即时动作的具体类

持续动作类的结构图
动作基类 CCAction的更多相关文章
- 【Cocos2d-X开发学习笔记】第12期:动作类CCAction的详细讲解
一般对于游戏中的精灵而言,它们不仅仅是存在于场景中,而且是动态展现的,例如,精灵移动的动态效果.动 画效果.跳动效果.闪烁和旋转动态效果等.每一种效果都可以看成是精灵的一个动作. 一.动作类(CCAc ...
- C++ - 虚基类、虚函数与纯虚函数
虚基类 在说明其作用前先看一段代码 class A{public: int iValue;}; class B:public A{public: void bPrintf(){ ...
- django中抽象基类的Foreignkey的定义
class base(models.Model): user = models.ForeignKey(User) class Meta: abstract =True 以上是抽象基类的定义,只有一个公 ...
- (转) C++中基类和派生类之间的同名函数的重载问题
下面有关派生类与基类中存在同名函数 fn: class A { public: void fn() {} void fn(int a) {} }; class B : public A { publi ...
- cocos2d-x 的两大基类
cocos2d-x 有两个重要的基类,一个管理引用计数的 Ref,别一个则定义许多基本属性的 Node. 在 cocos2d-x 中的基本概念 说到 create 函数的时候提到 cocos2d-x ...
- javascript组件开发之基类继承实现
上一篇文章大概的介绍了一下关于javascript组件的开发方式,这篇文章主要详细记一下基类的编写,这个基类主要是实现继承的功能 为什么要封装基类? 由于这次重构项目需要对各种组件进行封装,并且这些组 ...
- effective c++(07)之为多态基类声明virtual析构函数
class TimeKeeper { public: TimeKeeper() ; ~TimeKepper() ; ... } ; class AtomicClock:public TimeKeepe ...
- 《Programming WPF》翻译 第9章 2.选择一个基类
原文:<Programming WPF>翻译 第9章 2.选择一个基类 WPF提供了很多类,当创建一个自定义元素时,你可以从这些类中派生.图9-1显示了一组可能作为类--可能是合适的基类, ...
- Effective C++_笔记_条款07_为多态基类声明virtual析构函数
(整理自Effctive C++,转载请注明.整理者:华科小涛@http://www.cnblogs.com/hust-ghtao/) 这个规则只适用于polymorphic(带多态性质的)base ...
随机推荐
- 自定义tabpageindicator,可以自定义tab是三角形还是矩形,但是tab不具有滑动的功能
我是不会滴,但是看了一些大神写的,我修改了一下,大家可以参照参照 一,自定义Mytabpageindicator,直接贴代码了,具体的在代码中有注释 package com.wangy.mytabpa ...
- sgu 195 New Year Bonus Grant【简单贪心】
链接: http://acm.sgu.ru/problem.php?contest=0&problem=195 http://acm.hust.edu.cn/vjudge/contest/vi ...
- iOS框架你了解多少?
1.iOS 系统可以分为以下四层,每个框架对应IOS系统里的一层,每层建立在它下面层的上面.应该尽量使用上层的框架来代替下面的框架.更高层次的框架是对底层框架基于对象的抽象.以下列出几个iOS开发的常 ...
- SQLite支持的并发访问数
SQLite objects created in a thread can only be used in that same thread.The object was created in th ...
- IOS - 执行时 (多态)
一 多态概述 多态指同一操作作用于不同的对象.能够有不同的解释.产生不同的执行结果.它是面向对象程序设计(OOP)的一个重要特征,动态类型能使程序直到执行时才确定对象的所属类.其详细 ...
- 几款Java常用基础工具库
通用工具类(字符串.时间格式化.BeanUtils.IO) 1. commons-lang3库 1.1. org.apache.commons.lang3.StringUtils类 日常代码中,我们经 ...
- C#访问数据库的步骤
1.必须导入包含适当的ADO.NET类的名称空间 2.获取具体的数据库连接字符串. 3.实例化Connection对象,并建立.打开连接. 4.使用Command对象,从数据库存取器中读取数据和向数据 ...
- 【SHARE】WEB前端学习资料
参考资料:https://github.com/karlhorky/learn-to-program 学习网站:http://www.codecademy.com/learn https://www. ...
- Python 3 并发编程多进程之守护进程
Python 3 并发编程多进程之守护进程 主进程创建守护进程 其一:守护进程会在主进程代码执行结束后就终止 其二:守护进程内无法再开启子进程,否则抛出异常:AssertionError: daemo ...
- 【Flask】视图高级
# 视图高级笔记:### `add_url_rule(rule,endpoint=None,view_func=None)`这个方法用来添加url与视图函数的映射.如果没有填写`endpoint`,那 ...