Game Development Reference
In-Depth Information
[label setString:NSStringFromClass([system class])];
-(void) setNextParticleType
if (particleType == ParticleTypes_MAX)
particleType = 0;
Note The NSStringFromClass method is very helpful in this example for
printing out the name of the class without having to enter dozens of matching
strings. It's one of the cool runtime features of the Objective-C language that
you're able to get a class's name as a string. Try to do that in C++, and you'll
be biting your toenails. The Objective-C Runtime Programming Guide is a
good starting point if you'd like to dive into this advanced topic or if you just
want to learn how Objective-C works on a lower level: ht-
duction.html .
For game-play code, the NSStringFromClass and related methods hardly
play any role, but they're very helpful debugging and logging tools. You can
find a complete list and description of these methods in Apple's Foundation
Function Reference:
ce.html .
If you use one of these example effects in your own project, you might be shocked to
see ugly, square pixels. Figure 9-3 shows this effect very clearly. This occurs because
all the built-in particle effects try to load a specific texture named fire.png , which
is distributed with cocos2d-iphone in the Resources/Images folder. You can still
create very good particle effects even without a texture, provided that the particle sizes
Search Nedrilad ::

Custom Search