Assuming in your CCB the root node is a CCNode (A) and you add a child CCSprite (B) to it, then:
- if specified, the custom class of node A must be a subclass of CCNode
- if specified, the custom class of node B must be a subclass of CCSprite
Regarding the variable assignment:
- the variable of node A should be empty (at best it will create a reference to itself)
- if needed, the variable of node B should be set to "doc root" and given a legal ObjC variable name (ie
_nodeB
)
Now when you set the custom var of node B and it is set to "doc root", you must add a correspondingly named property or ivar to the custom class for node A. Which means node A must have a custom class for "doc root" variables to work. Let's name it CustomClassA
:
@interface CustomClassA : CCNode
{
CCSprite* _nodeB;
}
@end
Assuming you made node B use a custom class (inherited from CCSprite) you can also specify the custom class:
@class Grid;
@interface CustomClassA : CCNode
{
Grid* _grid;
}
@end
And add #import CCSpriteCustomClassB.h
to the implementation file of CustomClassA
.
Note that variable assignment does work without using a custom class in the node where you enter the variable name, but the root node must use a custom class for variable assignment to work.
PS: I'm not entirely clear on the "owner" variable setting. Normally owner will be nil, it's only non-nil when you specify it in code using CCBReader's load:owner:
method. This serves some purpose but I haven't found and can't think of a use case for it at the moment.