We will take a look at how to implement the different effects in Cocos2d using the CCEffects
class in this section.
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.
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 alloc]init]; } -(id)init{ CCLog(@" **** init **** "); if(self = [super init]){ CGSize winSize = [[CCDirector sharedDirector]viewSize]; self.contentSize = winSize; //Basic CCSprite - Background Image CCSprite* backgroundImage...