We will look at some of the more complex effects.
To add a glass effect, first of all, we need to add the glass image and then a normal map of the glass image to the project.
First, we will add the glass sprite to the scene, as follows:
//crystal sprite CCSprite* crystal = [CCSprite spriteWithImageNamed:@"granite_DIF.png"]; crystal.position = CGPointMake(winSize.width/2, winSize.height/2); [self addChild:crystal]; crystal.normalMapSpriteFrame = [CCSpriteFrame frameWithImageNamed:@"granite_NRM.jpg"];
Now that the glass sprite is added in, we can create the effect. We will execute the following code for this:
//** Glass effect CCEffectGlass* glassEffect = [CCEffectGlass effectWithShininess:1.0f refraction:1.0f ...