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.actionWithTarget(hero));
Field Detail
bottomBoundary
world bottomBoundary
leftBoundary
world leftBoundary
rightBoundary
world rightBoundary
topBoundary
world topBoundary
Method Detail
-
creates the action with a set boundary
creates the action with no boundary set// example // creates the action with a set boundary var sprite = cc.Sprite.create("spriteFileName"); var followAction = cc.Follow.create(sprite, cc.rect(0, 0, s.width * 2 - 100, s.height)); this.runAction(followAction); // creates the action with no boundary set var sprite = cc.Sprite.create("spriteFileName"); var followAction = cc.Follow.create(sprite); this.runAction(followAction);
- Returns:
- {cc.Follow|Null} returns the cc.Follow object on success
-
{Boolean} initWithTarget(followedNode, rect)initializes the action initializes the action with a set boundary
- 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.