The < - image(click to see larger view) showcase my experiment with shader in Cocos2d (v2.0). A modified box blurring algorithm was used in the fragment shader and this is only applied to sprites (each individual building is a separate sprite) that are above or below the two hardcoded threshold (y-position). The blurring algorithm was modified in such a way that the amount of blur applied to the sprite is dependent on how far above or below either y thresholds the sprite is. Continue reading Tilt Shift Effect in Cocos2d (v2.0+)
Tag Archives: cocos2d
3D Parallax Effect On 2D Plane
The above video demonstrates an experiment I did in an attempt to reproduce the illusionary 3D Parallax effect on a 2D plane using flat images. Its just for fun really. I saw the video of this effect for iOS7 and I was asking myself if I could reproduce it using only sprites.
Continue reading 3D Parallax Effect On 2D Plane
Objective-C Singleton Class
Using this SynthsizeSingleton.h to create a singleton class in obj-c.
Include the .h into project.
add
SYNTHESIZE_SINGLETON_FOR_CLASS_HEADER(ClassName);
into the ClassName.h.
And add
SYNTHESIZE_SINGLETON_FOR_CLASS(ClassName);
into ClassName.m.
That…should be about it. Unless i missed some stuff out…. will look over…
oh You can then call the class by using
[[ClassName sharedClassName] someProperty];
Cocos2d Pop Scene With Transition
Pasting this here for my future reference. Originated from the cocos2d-iphone forum.
”
Add this to CCDirector.h, just after the declaration -(void)popScene (line 402):
- (void) popSceneWithTransition: (Class)c duration:(ccTime)t;
Then add this to CCDirector.m, just after the definition of -(void)popScene (line 768):
-(void) popSceneWithTransition: (Class)transitionClass duration:(ccTime)t
{
NSAssert( runningScene_ != nil, @"A running Scene is needed");
[scenesStack_ removeLastObject];
NSUInteger c = [scenesStack_ count];
if( c == 0 )
{
[self end];
}
else
{
CCScene* scene = [transitionClass transitionWithDuration:t scene:[scenesStack_ objectAtIndex:c-1]];
[scenesStack_ replaceObjectAtIndex:c-1 withObject:scene]; nextScene_ = scene;
}
}
You can call the method like this:
[[CCDirector sharedDirector] popSceneWithTransition:[CCSlideInRTransition class] duration:0.5f];
Adwhirl and Cocos2d-iPhone
I had previously meddled with iAd implementation in a cocos2d project before, so implementing it in ROTATE (a game project in progress) was simply copy-pasta. Then an issue was discovered as I researched into mobile ad networks: iAd is not as efficient as I hoped and it is not available for apps worldwide (it is limited to some countries as of now). Since I am looking to release both DROP and ROTATE to be free and ad-supported games, I need an effective solution. Adwhirl, that’s what I came across. It mediates ad banners from different networks and put them into your app.
Continue reading Adwhirl and Cocos2d-iPhone
Game Center: Leaderboard
My project Drop, which has been in development for almost a year, is being stalled due to various reasons. Pretty much stuck on the artistic side of stuffs, but it will be completed. Meanwhile I have already began work on another game project, one thats based on a much simpler premise and I foresee a development time of no more than a month.
Continue reading Game Center: Leaderboard
Of Hiero and BMFonts
UPDATE: Well, seem like cocos2d had advanced further than I could google. Apparently by adding a .ttf into your project, you can just use CCLabel with that font. Changing font size with no issue.
Continue reading Of Hiero and BMFonts