| cocos2d-x 3.0 |
)- 类列表 - 类索引 - 类继承关系 - 类成员
全部) 类) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义) 组) 页)
Public 成员函数 | 静态 Public 成员函数 | Public 属性 | Protected 属性 | 所有成员列表
Follow类 参考 Actions
Follow是一种“跟随”某一个节点的动作. 更多…
#include
类 Follow 继承关系图:
| ## Public 成员函数 | |
| bool | isBoundarySet () const |
| void | setBoudarySet (bool value) |
| 调用这个方法打开或关闭边界 更多… | |
| virtual Follow | clone () const override |
| 返回action的克隆对象 更多… | |
| virtual Follow | reverse () const override |
| 返回执行与本Action对象相反操作的新Action对象 更多… | |
| virtual void | step (float dt) override |
| 这个方法每一帧都会被调用, 参数dt为两帧之间的时间间隔(单位秒). 除非你知道正在做什么否则不要重载这个方法. 更多… | |
| virtual bool | isDone () const override |
| 当action完成时返回true 更多… | |
| virtual void | stop () override |
| 方法在action完成之后调用,它将执行Action的target对象设置为nil. 更多… | |
| CC_CONSTRUCTOR_ACCESS | _boundarySet (false) |
| CC_CONSTRUCTOR_ACCESS | _boundaryFullyCovered (false) |
| CC_CONSTRUCTOR_ACCESS | _leftBoundary (0.0) |
| CC_CONSTRUCTOR_ACCESS | _rightBoundary (0.0) |
| CC_CONSTRUCTOR_ACCESS | _topBoundary (0.0) |
| CC_CONSTRUCTOR_ACCESS | _bottomBoundary (0.0) |
| CC_CONSTRUCTOR_ACCESS | _worldRect (Rect::ZERO) |
| virtual | ~Follow () |
| NA NA 更多… | |
| bool | initWithTarget (Node followedNode, const Rect &rect=Rect::ZERO) |
| 初始化action 可以提供边界,也可以比提供 更多… | |
Public 成员函数 继承自 Action | |
| virtual std::string | description () const |
| NA NA 更多… | |
| virtual void | startWithTarget (Node target) |
| 方法在action开始前调用, 操作会设置执行Action的目标对象为target. 更多… | |
| virtual void | update (float time) |
| 每一帧都会调用这个方法,参数time是一个在0和1之间的值 更多… | |
| Node | getTarget () const |
| void | setTarget (Node target) |
| 这个方法更改action的target属性. 更多… | |
| Node | getOriginalTarget () const |
| void | setOriginalTarget (Node originalTarget) |
| 设置action的原始目标对象target, 当target为nil时setOriginalTarget设置的对象会运行这个action 除非你要像ActionManager类那样做一些很复杂的操作,否则不要调用这个方法 本方法只是对originalTarget的弱引用(assigned),没有进行retain操作。 更多… | |
| int | getTag () const |
| void | setTag (int tag) |
Public 成员函数 继承自 Ref | |
| void | retain () |
| 保留所有权. 更多… | |
| void | release () |
| 立即释放所有权. 更多… | |
| Ref | autorelease () |
| 自动释放所有权在不久的将来. 更多… | |
| unsigned int | getReferenceCount () const |
| 返回Ref对象当前的引用计数. 更多… | |
| virtual | ~Ref () |
| NA NA 更多… | |
Public 成员函数 继承自 Clonable | |
| virtual | ~Clonable () |
| NA NA 更多… | |
| CC_DEPRECATED_ATTRIBUTE Ref | copy () const |
| 返回Ref对象的一份拷贝. 更多… | |
| ## 静态 Public 成员函数 | |
| static Follow | create (Node followedNode, const Rect &rect=Rect::ZERO) |
| 创建action 可以有边界,也可以没有. 更多… | |
| ## Public 属性 | |
| CC_CONSTRUCTOR_ACCESS | pad0: Follow() : _followedNode(nullptr) |
| ## Protected 属性 | |
| Node | _followedNode |
| bool | _boundarySet |
| bool | _boundaryFullyCovered |
| Vec2 | _halfScreenSize |
| Vec2 | _fullScreenSize |
| float | _leftBoundary |
| float | _rightBoundary |
| float | _topBoundary |
| float | _bottomBoundary |
| Rect | _worldRect |
Protected 属性 继承自 Action | |
| Node | _originalTarget |
| Node * | _target |
| action动作的执行目标target. 更多… | |
| int | _tag |
| action的tag属性. 更多… | |
Protected 属性 继承自 Ref | |
| unsigned int | _referenceCount |
| 引用计数 更多… | |
| ## 额外继承的成员函数 | |
静态 Public 属性 继承自 Action | |
| static const int | INVALID_TAG = -1 |
| 所有Action对象的缺省tag值 更多… | |
Protected 成员函数 继承自 Action | |
| Action () | |
| virtual | ~Action () |
Protected 成员函数 继承自 Ref | |
| Ref () | |
| 构造函数 更多… | |
详细描述
Follow是一种“跟随”某一个节点的动作.
示例代码:
layer->runAction(Follow::actionWithTarget(hero));
不要使用Camera作为一个跟随者,使用这个类
- 自从
- v0.99.2
构造及析构函数说明
| virtual |
NA NA
成员函数说明
| CC_CONSTRUCTOR_ACCESS _bottomBoundary | ( | 0. | 0 | ) |
| CC_CONSTRUCTOR_ACCESS _boundaryFullyCovered | ( | false | ) |
| CC_CONSTRUCTOR_ACCESS _boundarySet | ( | false | ) |
| CC_CONSTRUCTOR_ACCESS _leftBoundary | ( | 0. | 0 | ) |
| CC_CONSTRUCTOR_ACCESS _rightBoundary | ( | 0. | 0 | ) |
| CC_CONSTRUCTOR_ACCESS _topBoundary | ( | 0. | 0 | ) |
| inline |
| overridevirtual |
返回action的克隆对象
实现了 Action.
| static |
创建action 可以有边界,也可以没有.
- 参数
followedNode要跟随的Node. rect边界. 当
rect为 Rect::ZERO时 表示没有边界.
| bool initWithTarget | ( | Node * | followedNode, |
| const Rect & | rect = Rect::ZERO | ||
| ) |
初始化action 可以提供边界,也可以比提供
- 参数
followedNodeThe node to be followed. rectThe boundary. If
rectis equal to Rect::ZERO, it'll work with no boundary.
| inline |
| overridevirtual |
当action完成时返回true
重载 Action .
| overridevirtual |
返回执行与本Action对象相反操作的新Action对象
实现了 Action.
| inline |
调用这个方法打开或关闭边界
| overridevirtual |
这个方法每一帧都会被调用, 参数dt为两帧之间的时间间隔(单位秒). 除非你知道正在做什么否则不要重载这个方法.
重载 Action .
| overridevirtual |
方法在action完成之后调用,它将执行Action的target对象设置为nil.
IMPORTANT: 你不应该直接去调用 "action->stop()" 方法, 而应该调用 "target->stopAction(action);"
重载 Action .
类成员变量说明
| CC_CONSTRUCTOR_ACCESS pad0 |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
该类的文档由以下文件生成:
- /Users/zeroyang/Documents/github/cocos2d-x/cocos/2d/CCAction.h
Public 成员函数 继承自 
