Game Development Reference
In-Depth Information
Blocks have a wide variety of uses. For example, they're used as callback mechanisms
for Game Center classes, and they're essential for multithreading applications with
Grand Central Dispatch and other Cocoa technologies. Internally, cocos2d converts all
target/selector menu items to calls with blocks as well. Despite the syntactical oddities,
I encourage you to work with blocks because you may be required to understand and
use them sooner than you think. And you can start unlocking their powerful secrets
sooner as well.
Actions
Actions are lightweight, one-shot classes you use on nodes to perform certain, well, ac-
tions. They allow you to move, rotate, scale, tint, fade, and do a lot of other things with
a node. Because actions work with every node, you can use them on sprites, labels, and
even menus or whole scenes! That's what makes them so powerful.
In Figure 3-10 you can see the CCAction class hierarchy without the many sub-
classes of CCActionInterval and CCActionInstant . (You'll see their class
hierarchies in Figures 3-11 and Figure 3-16 . )
Figure 3-10 . The CCAction class hierarchy with subclasses of CCActionInstant and CCActionInterval omitted
Only three actions directly derive from CCAction :
CCFollow (allows a node to follow another node)
CCRepeatForever (repeats an action indefinitely)
CCSpeed (changes the update frequency of an action while it's running)
 
 
 
Search Nedrilad ::




Custom Search