Class cc.Follow
- Defined in: CCAction.js
- Extends cc.Action
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
cc.Follow is an action that "follows" a node.
|
Method Summary
Class Detail
cc.Follow()
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));
Field Detail
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
leftBoundary
world leftBoundary
rightBoundary
world rightBoundary
topBoundary
world topBoundary
Method Detail
-
ctor(followedNode, rect)creates the action with a set boundary
creates the action with no boundary set Constructor of cc.Follow// example // 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);- Parameters:
- {cc.Node} followedNode
- {cc.Rect} rect
-
{Boolean} initWithTarget(followedNode, rect)initializes the action initializes the action with a set boundary
- Parameters:
- {cc.Node} followedNode
- {cc.Rect} rect Optional
- Returns:
- {Boolean}
-
{Boolean} isBoundarySet()
- Returns:
- {Boolean}
-
{Boolean} isDone()
- Returns:
- {Boolean}
-
setBoudarySet(value)alter behavior - turn on/off boundary
- Parameters:
- {Boolean} value
-
step(dt)
- Parameters:
- {Number} dt
-
stop()Stop the action.