Game Development Reference
In-Depth Information
Note If several nodes end up with the same tag number, getChildByTag
will return the first node with that tag number. The remaining nodes will be in-
accessible. Make sure you use unique tag numbers for your nodes.
Note that actions can have tags, too. Node and action tags don't conflict,
however, so an action and a node can have the same tag number without any
problem.
Working with Actions
Nodes can also run actions. I'll cover actions more in a bit. For now, just know that ac-
tions can move, rotate, and scale nodes—and can do other things with nodes over time.
▪ Here's an action declaration:
CCAction* action = [CCBlink actionWithDuration:10
blinks:20];
action.tag = 234;
▪ Running the action makes the node blink:
[myNode runAction:action];
If you need to access the action at a later time, you get it by its tag:
CCAction*
retrievedAction
=
[myNode
getAc-
tionByTag:234];
▪ You can stop the action by tag:
[myNode stopActionByTag:234];
▪ Or you can stop it by pointer:
[myNode stopAction:action];
▪ Or you can stop all actions running on this node:
[myNode stopAllActions];
Scheduled Messages
Search Nedrilad ::




Custom Search