cocos2d-iphone

How/where to release global variables in objective c? -iphone

I have gone through the following question. http://stackoverflow.com/questions/1528696/objective-c-where-do-you-dealloc-global-static-variables But the question is related on static variables. It has something different situation then mine. I have following code in application. //.h file #import "cocos2d.h" #import "something.h" #imp...

Replacing image in sprite - cocos2d game development of iphone

I want to change the sprite image. Say for example. mainSprite=[Sprite spriteWithFile:@"redFile.png"]; [self addChild:mainSprite]; Here, Sprite is already added to a layer. I have mainSprite (pointer) which can access it. If I change [mainSprite setOpacity:150]; it works perfectly. But Here I want to change the sprite image inst...

How to display layer over view?

Hi all, I have one background view, which I added on openglview of cocos2d. I have to display a snow falling effect above that background view so I created one layer, then i created a Scene by using that layer, then run that scene after adding my background view on opengl view. I am expecting that snow falling effect is display over my b...

iPhone Memory Management: No Need to Clean Up and Release Retained Objects on App Quit?

Is the following true? When the app is about to quit, it's not necessary to clean up the memory by calling release on all your retained objects, because the iPhone OS will reclaim the memory it allocated for your app when you launched it. This is faster and safer than rely on the apps to correctly clean up after thems...

iPhone Dev: Pocket God Used Graphic Engine

I want to develop a 2d game. I have to choose from Quartz/CoreGraphics, OpenGL ES or Cocos2D. I'm interested in how the game Pocket God is realized because it fulfills perfectly my needings. Do you know which technology is used to build the game Pocket God? ...

Text Typing Effect in iPhone cocos2d Game

In many games, when a character is speaking (dialogue), the text has a typing effect, where it looks like you are watching the character type the text. What would be a good way to achieve this look and (simple) "animation" for an iPhone game which uses cocos2d? It's good if there's a way to do it with cocos2d, but I'm not completely op...

Cocos 2d - sound effect

I am a newbie in cocos 2d framework. Now I want to write a small game which receive my void from the microphone of iPhone. So what knownledge do I have to learn and any document links I have to read? Thanks in advance. ...

Possible circular reference problem

I am not an idiot, but header files make me feel like one sometimes. I have what is probably an overly-complicated set-up that has an error that I cannot resolve. Here it is in about as simple as detail as I can make it.... I have a Controller class that contains a Model class. I have a Scene class to capture actions and communicates ...

cocos2d in iphone z order

Hi guys, I am working on a game with many sprites in a layer, and once you touch the sprite, it will do something. my problem is the z order issue, most of my sprites are overlapping and when you touch the overlapping sprites, the one behind(i think with the lowest z order) react instead of the one in front. I need to understand more ...

MultiView application for iphone

Hi All, I am new to the iphone development and have to develop a multivew application for the same. I want to do the following: On click of a button in the main window; we have to open a new view that has a toolbar with items & a tab bar in it; with some text data in between from a service. If the user click on any of the toolbar ite...

What's the best practice in cocos2d to redirect an animating sprite?

I am making a game where 'defending' sprites need to animate towards 'attacking' sprites. But for example an attacker might change course to attack something else, mid animation. What's the best way to manage animations, and destinations? I believe I must remove any action on a sprite before adding a new one. Perhaps I need to use the s...

Am I asking too much with my collision detection method for Cocos2d?

So I'm trying to do collision detections between sprites in cocos 2d. Although I think I may be asking too much as it crashes and the compiler doesn't give me an error, the iPhone simulator just freezes and then gives up. There's a lot of looping involved so I'm guessing it's just too much... but I can't be certain. My intention was to ...

COCOS2D:How to call a nib file from cocos menu and vice versa?

Hi Devs, I m developing a game where all the settings page, score page, help pages are in nib formace and the game is in cocos2d scene format (Gamescene.h and m file). So i need to call the game scene of from a nib file when "Start game" button is pressed from the nib. And when the game is over , i need to call the score .nib from the ...

Problem using chipmunk

I made a game that using a character that can moving left or right by touching the screen, above the character, it is a apple, what i need is the apple will fall down, the character may push the apple up again just like playing volleyball. That's the problem,what i have learnt from "bounding ball" is give a sprite a shape and body, then ...

How to subclass AtlasSpriteManager in Cocos2d?

I need to create some compound sprites that will all move and rotate together. Since it's possible to change the position and rotation of an AtlasSpriteManager I've been trying to subclass so I can create a bunch of shortcuts like CompoundSprite *cSprite = [CompoundSprite spriteManagerWithFile:@"sprites.png"]; [cSprite makeComplexSprite...

Preloading multiple background music

I am trying to preload a bunch of background music files. Basically i am calling preloadBackgroundMusic several times. This breaks on me when i try it with SimpleAudioEngine : [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:@"vitesse1.mp3"]; [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:@"vitesse1.mp3"]; but when I...

Cocos2d - Shooting Game Problem

Hi,everyone, I made a shooting game just like 1942(classic shooting game),but here's the question, FPS drops to 5~6 when the fighter shoot out a straight line of bullet,about 7~8 bullets in the screen,Actually, only 8 bullets of player will appear in games, when bullets fly out of the screen they would reset to the fighter's center and b...

How to fix an 'Object' may not respond to 'method' warning in Cocos2d.

In cocos2d, I'm trying to call a method on the Parent of a CocosNode. The app works fine, but I get an 'Object' may not respond to 'method' warning. The parent is a subclassed Cocos2d layer, so I'm guessing I need to cast parent somehow, but that generates fatal errors. The method is like this if(CGRectContainsPoint([newBrick boundingB...

Is anyone have memory leaks using cocos2d?

I am detecin a memory leak particularily in the startAnimation method in the director object. - (void) startAnimation { if ( gettimeofday( &lastUpdate, NULL) != 0 ) { CCLOG(@"cocos2d: DisplayLinkDirector: Error on gettimeofday"); } // approximate frame rate // assumes device refreshes at 60 fps int frameInterva...

A problem when using PageTransitionForward and Backward

http://www.youtube.com/watch?v=DyssOSmwuoo according to my video when call animation PageTransitionForward it will have a triangle on the left and that triangle can see through next layer how can i fix it? ...