Game Development Reference
In-Depth Information
Figure 12-7
.
The monsters are glowing red hot thanks to the particle effect
The effect is most visible on the monsters, which seem to be glowing hot. Yet you can't
make out individual particles and they blend perfectly with the background, which makes
this effect worth seeing in the game. Preferably you'll check this out on a device since the
Simulator now renders this scene with maybe 15 frames per second (fps) at most.
Shader Effects
Cocos2D's latest feature is shader effects, typically in the form of the
Effect
node, which
applies a given shader effect to all of its children.
Sprites can also have one or more shader effects applied to them without the need for a
separate
Effect
node. The user interface and available shaders and their parameters are the
same for both.
Adding an Effect Node
To try out the
Effect
node, open
MainScene.ccb
and then drag and drop an
Effect
node
from the
Node Library View
onto the stage. The
Effect
node, much like the
Color
node,
has an implied size of 100x100 points.
Since the
Effect
node applies its effect to its children, this also means that it will draw only
the children within its frame, determined by the
Effect
node's
Content size
property.
Search WWH ::
Custom Search