Game Development Reference
In-Depth Information
If you assign the variable by its nameāfor instance, by using
getChildByName:
, you
should verify the following:
Check that the name of the node is the same as the name of the node in
SpriteBuilder.
Check that there is no other node with the exact same name.
Check that the name of the node in the Timeline and its
Name
property are
two different things. Only the
Name
property counts; the node's name in the
Timeline is purely informational and not used by Cocos2D.
Test whether
[self.scene
getChildByName:@"theNameOfTheNode" recursively:YES]
finds the node. If it doesn't, the node in question simply isn't in the current
scene. Note that
self.scene
is
nil
during a node's
init
and
didLoadFromCCB
methods, so be sure to perform that test in
onEnter
or at a later time.
Check that the name of a CCB root node will not be used if it is referenced
in another CCB file via a
Sub File
(
CCBFile
) node. In that case, the name
needs to be set on the
Sub File
node, not the CCB's root node that the
Sub
File
node references.
Animation Playback Issues
If an animation played programmatically through the
self.animationManager
won't play, check the following items:
The name of the animation in code matches the name of the animation in
SpriteBuilder. Note that the case must match, too.
Each CCB has its own animation manager instance. If
self.animationManager
is used by the root node's custom class of
the CCB that contains the Timeline, you are using the correct instance.
Otherwise, double-check that you are using
self.animationManager
in a node's custom class that is a child node of the CCB containing the
Timeline and isn't a
CCBFile
(Sub File) reference.
Search WWH ::
Custom Search