O'Reilly logo

Cocos2d Cross-Platform Game Development Cookbook - Second Edition by Siddharth Shekar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CCEffects

We will take a look at how to implement the different effects in Cocos2d using the CCEffects class in this section.

Getting ready

The assets for this chapter are included in the resources. Import them into the iOS-Published folder in Finder.

For this chapter, I created a new project; so, if you want to create a new project, go ahead and make the necessary changes.

How to do it…

Once we create the project, we will add in the following code to the MainScene.h file:

@interface MainScene : CCNode{

  CCSprite* hero;

}

+(CCScene*)scene;

@end

Here, we want to keep the hero as a global variable. The rest is as usual.

Next, in the MainScene.m file, we will add the following:

#import "MainScene.h" @implementation MainScene +(CCScene*)scene{ return[[self ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required