Sprite Animations Without Sprite Sheets
You can simulate any animations if you have a sequence of images which makes the illusion of that animations and rendering those images to the screen. In cocos2D it can be done in two ways, with sprite...
View ArticleHow to use CCProgressTimer in Cocos2D to show progress?
The progress timer takes a sprite and, based on a percentage, displays only a part of it to visualize some kind of progress in your game. CCProgressTimer* timer = [CCProgressTimer...
View ArticleSimulate a Balloon in Box2D, iPhone or ANDROID
Hello……… Sometimes you may want your body to act against the gravity of the world. One method to do this is described below. First what you have to do is to make a body in the shape of a circle and...
View ArticleHow to get Device Orientation in Cocos2D, iPhone in Objective C?
Hello all…… We may need to know that what is your current device orientation. Using the below code you can do this. if([[UIDevice currentDevice] orientation] == kCCDeviceOrientationPortrait) {...
View ArticleHow to change the background color of a Layer in Cocos2D using CCColorLayer?
Set background color to magenta. CCColorLayer* colorLayer = [CCColorLayer layerWithColor:ccc4(255, 0, 255, 255)]; [self addChild:colorLayer z:0]; //Changing the color of a sprite.......
View ArticleUsing of CCWaves in iPhone
CCWaves is one of the interesting functionalities in Cocos2D iphone. Check out this following snippet to see how it works. id my_wavesAction = [CCWaves actionWithWaves:7 amplitude:25 horizontal:NO...
View ArticlePause And Resume iPhone Game Using Cocos2D
More than usually we need to apply the functions of Pause and Resume/Play for our games. In Mac’s cocos2D programming it’s more than simple. Simply use the following code for Pause & Resume where...
View ArticleHow to Pause and Resume a Cocos2D game ?
Hi, For pausing a cocos2D game, then use the following line of code. [[CCDirector sharedDirector] pause]; For resuming a cocos2D game, then use this line of code. [[CCDirector sharedDirector] resume];...
View ArticleHow to move a body manually in Box2D? or Give a force to a body in Box2D,...
This is a sample code to move a body in Box2D . First you have to make a body with variable name “moving_rec” and call the below function in a schedular at regular intervals. -(void) moveBody{ b2Vec2...
View ArticleHow to find your Google Plus ID
This is so simple 1. Go to your Google + account (https://plus.google.com/). 2. Click on the Profile icon on the Left. 3. If you look at the URL in the address bar, it should look something like this:...
View Article