Class cc.Follow
- Defined in: CCAction.js
- Extends cc.Action
Constructor Attributes | Constructor Name and Description |
---|---|
cc.Follow(followedNode, rect)
cc.Follow is an action that "follows" a node.
|
Method Summary
Class Detail
cc.Follow(followedNode, rect)
cc.Follow is an action that "follows" a node.
//example //Instead of using cc.Camera as a "follower", use this action instead. layer.runAction(cc.follow(hero));
// creates the action with a set boundary var sprite = new cc.Sprite("spriteFileName"); var followAction = new cc.Follow(sprite, cc.rect(0, 0, s.width * 2 - 100, s.height)); this.runAction(followAction); // creates the action with no boundary set var sprite = new cc.Sprite("spriteFileName"); var followAction = new cc.Follow(sprite); this.runAction(followAction);
Field Detail
{Number}
bottomBoundary
- world bottomBoundary.
Please use cc.follow instead.
creates the action with a set boundary.
creates the action with no boundary set.
creates the action with no boundary set.
- Deprecated:
- since v3.0 please cc.follow() instead.
{Number}
leftBoundary
- world leftBoundary.
{Number}
rightBoundary
- world rightBoundary.
{Number}
topBoundary
- world topBoundary.
Method Detail
-
{cc.Follow} clone()to copy object with deep copy. returns a clone of action.
- Returns:
- {cc.Follow}
-
ctor(followedNode, rect)Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
creates the action with a set boundary.
creates the action with no boundary set. -
{Boolean} initWithTarget(followedNode, rect)initializes the action with a set boundary.
- Returns:
- {Boolean}
-
{Boolean} isBoundarySet()Get whether camera should be limited to certain area.
- Returns:
- {Boolean}
-
{Boolean} isDone()Return true if the action has finished.
- Returns:
- {Boolean}
-
setBoudarySet(value)alter behavior - turn on/off boundary.
- Parameters:
- {Boolean} value
-
step(dt)called every frame with it's delta time.
DON'T override unless you know what you are doing.- Parameters:
- {Number} dt
-
stop()Stop the action.