Game Development Reference
In-Depth Information
Figure 2-18 . Size types available for the Content Size property
Assuming an example node is centered on the layer with Position 50%, 50% and An-
chorPoint 0.5, 0.5, an inset of 100 x 40 would change the node's contentSize so that
it is 100 by 40 points smaller than its parent. In this particular instance, the node is per-
fectly centered so its size would be 50 points smaller on both the left and right sides, and
20 points smaller on the top and bottom. The same effect can be achieved by editing the
position and content size, though less conveniently.
Changing Node Draw Order
One last but important property is the draw order, in Cocos2d often referred to as zOrder.
Sprite Kit users know it as zPosition. But alas, there is no such property under the
CCNode properties or anywhere else. The trick here is that, in SpriteBuilder, draw order is
solely defined by the order of children in their parent container. In SpriteBuilder, the only
way to change draw order is by reordering nodes in the Timeline View.
Drag and drop a Color Node onto the stage, on top of the existing Gradient Node. The
Timeline will look like Figure 2-19 .
Figure 2-19 . The Timeline lists a CCB file's nodes in a hierarchical view
Now if you want the Color Node to be drawn behind (under) the Gradient Node, you just
drag and drop it in the Timeline outline view above the Gradient Node. The result should
be the same as in Figure 2-20 .
Search WWH ::




Custom Search