cocos2d

ccnode addChild: CCTMXTiledMap

I have a Mapclass which subclasses CCNode In the main function I do this: MapClass * map = [MapClass alloc] initWith:@"test.tmx"]; In map I initialize CCTMXTiledMap * tileMap... and do [self addChild:tileMap]. Back in the Main function I do [self addChild:map]; I don't get any errors but I do get a blank screen. If I don't use the ...

how to reset game in cocos2d

My question in the previous post was- I have a cocos2d game, and after I exit the game and start it again, it starts at the exact same point it was before closing.why this is happening??and not only this, my game is landscapemode but when i start it again from simulator it comes in potrait mode,not it landscapemode like...

schedule - how many ticks ago?

Is there a way to have a reference to schedule and find out how many times it has already ticked by using the schedule object itself? [self schedule:@selector(a:) interval:1.0]; ...

Simultaneous Sprite Touch Detection - iPhone & cocos2d

I am writing an app for the iPhone using cocos2d where I have 4 Sprites that are buttons. I figured I would implement the button functionality by using 2 sprites with different .png files representing the pressed/unpressed states. I thought this would be better than using an animation. In addition to detecting when the buttons are pre...

Is it possible to get a 16-bit depth buffer on the iPhone?

Hi! We're making a game using cocos2d but are having problems with the depth buffer. I'm trying to setup a 16-bit depth buffer on the iPhone but so far I only get 24-bit depth. The reason I want 16-bit depth buffer is: A: I don't need the precision of 24-bit. B: I'm hoping it will be faster. This is how I set the depth format in...

Limiting number of simultaneous sounds in CocosDenshion/Cocos2D

Hi, I'm building a game which will play a handfull of sounds all the time (rockets, rocket impacts etc). After a mere moment this turns into a real mess and i figured i need to limit the number of sounds. Problem is i don't want to decrease the number of channels of something because then one type of sound could "hog" the channels and ot...

Free iPhone Game Programming Libraries

I have been using Cocos2d for some time now and it is AWESOME! I was wondering if there are some other libraries for creating iPhone game. Maybe also 3d game libraries!! ...

Am I using CocosDenshion correctly?

I have found a tonne of leaks in my code. All of them come about when I play a sound or a song. Here is how I call a sound effect: [[SimpleAudioEngine sharedEngine] playEffect:@"myeffect.wav"]; Here is how I play a song: [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"mysong.mp3"]; Am I somehow supposed to be releasing t...

Cocos 2d body & its fixtures

Hi there, Well I try to implement the run action to move a specific sprite towards the specific destination, I can achieve that using the below code snippet. [spriteA runAction:[CCSequence actions:[CCMoveTo actionWithDuration:0.2 position:realDest],[CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)],nil]]; But ...

How to create a level with curved lines with cocos2d + Box2d on the iphone?

Hello, I'd like to create a game that has levels such as this: http://img169.imageshack.us/img169/7294/picdq.png The Player moves "flies" through the level and mustn't collide with the walls. How can I create such levels? I found that piece of software: http://www.sapusmedia.com/levelsvg/ It's not that cheap, so I wonder whether the...

Cocos2d CCLabel update problem for scores

I am using two calls setScore which is going in the init method and UpdateScore when an object is destroyed. When I run the program, I get a crash as soon as UpdateScore is called. Anyone see errors with my code? Thank you very much. In my .h file I have CCLabel *score; and NSString *text; declared for global use. -(void)setScore{ sc...

[ios.cocos2d+box2d]how to disable auto-rotation?

I have created a project with cocos2d 0.99.5 + box2d. When I rotate my iphone, Screen automatically rotated too. So the boxes Flew up into the ceiling. How to disable auto-rotation? plz ...

Game Center - orientation

Cocos2d version: v0.99.04 I'm adding Game Center to my current application and I found some code to open up the GKMatchmakerViewController. It seems to work well, except when it gets dismissed it changes the orientation in the simulator to portrait. The game only runs in landscape. I rotate the device back to landscape and all the cocos...

Trying to Integrate Mail Into my app, getting 2 warnings.

I'm trying to integrate sending mail into my app, but I end up with 2 warnings. I am using Obj-C, the Cocos2d Framework. This is my code. -(void) mailTapped: (id) sender { MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init]; composer.mailComposeDelegate = self; if ([MFMailComposeViewController canSe...

Using libRocket with iOS

I'm trying to use libRocket in an iPhone application (with cocos2d), but I can't seem to get over OpenGL error 0x0500 in -[EAGLView swapBuffers]. It seems to be triggered when calling glDrawElements(GL_TRIANGLES, num_indices, GL_UNSIGNED_INT, indices); in ShellRenderInterfaceOpenGL. I had to change GL_RGB8 to GL_RGB in the GenerateText...

Detecting Simultaneous Button Presses and other Gestures, Shakes and Tilts - Cocos2d & iPhone.

I am writing an app for the iPhone using cocos2d where I have 4 Sprites that are buttons. I want to allow and respond to the following (allowing the user 3 seconds to apply his input before timing out): -- Single button presses (I have this part working). -- Pressing of more than 1 button at at the same time (each combination would have...

Multi-touch detecting & differentiating - Cocos2d for iPhone

I would like to know how to detect and differentiate between touches in a multi-touch view. I have read about a "hash" code, but I don't understand how to use it. I want to know when two of my Sprites are touched at the same time, like as if pressing a chord on two keys of a piano. [EDIT] Here is an example of what I have for my ccTou...

Iphone multitouch handling

I'm writing an iPhone app, and I want to handle multitouches. I'm using cocos2d libs. So I've made a CCLayer subclass and set it to be a CCStandartTouchDelegate. For some reason I don't want to use UIGestureRecognizer and to build a correct logic I should know the answers for these questions: If I tap the screen with one finger, and th...