cocos2d-iphone

Error, could not create MachMessagePort for database doctor (com.apple.addressbook.migrationdaemon) starting in process migration

I'm working in address book for iphone. it generate address into UILabel. when I'm running the application everything goes well, but after showing about %30 of the addresses and sadenly stopped without any reason! Only in terminal shows: Error, could not create MachMessagePort for database doctor (com.apple.addressbook.migrationdaemon) s...

Playing sequence of PNG files in cocos2d iphone

I want to play an sequence of png files for animation. I tried executing the following code in cocos2d iphone -(void) onEnter { [super onEnter]; roadSprite=[[Sprite spriteWithFile:@"R00.png"] retain]; [roadSprite setPosition:ccp(240,160)]; [self addChild:roadSprite z:5]; Animation* animation = [Animation anima...

Tick/Draw Method

I'm looking for the Tick and draw method, and I'm not sure where they are. Do I have to make them from scheduler, if so how? I've heard that the draw method is only called 4 frames per second when 'paused', so does it exist somewhere? ...

Statusbar orientation changes after dismissing modal view

My statusbar orientation is landscape, I have a cocos2d view that only supports portrait orientation(it is OK since it handles transformations). I have another view that is presented as a modal by cocos2d controller, its orientation is landscape, but whenever I dismiss it, my statusbar orientation somehow changes to portrait, I tried ove...

How to have a menu when a movie is playing-iphone cocos2d

I play a movie using the following code NSString *path = [[NSBundle mainBundle] pathForResource:@"cobra" ofType:@"mp4"]; theMovie=[[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:path]]; theMovie.scalingMode=MPMovieScalingModeAspectFill; // Add an observer to catch when playback ends [[NSNotificationCenter def...

What would cause a Cocos2d iPhone font to only showing 2/3rds of the letter/number?

I am trying to use this font in a cocos2d iPhone game. The font only shows 2/3rds of the letter/number. If I open the text editor installed with OS X and use the font, the letters appear fine. Any ideas to what may be wrong? Here's the code snippet showing how I display a string using the font: CCLabel* number = [CCLabel labelW...

Cocos2d Resources

Any recommendations on good sites/resources on programming with the Cocos2d-iPhone game engine? What worked for you? What is the canonical place for all things Cocos2d? Any sites you recommend? Best practices? Blogs? Much appreciated ...

Accessing sprites in a NSMutableArray returns an error - simple question

Why doesn't this work? // spriteArray is an NSMutableArray int spriteWidth = [spriteArray objectAtIndex:0].contentSize.width; I get the error: Request for memeber 'contentSize' in something not a structure or union If I change the code: CCSprite *tempSprite = [spriteArray objectAtIndex:0]; int spriteWidth = tempSprite.contentSize.w...

How to get current value of UITextField in cocos2d 0.8.2?

Hi all I am using cocos2d 0.8.2 for my new game. I have added a UITextField in my game and on click of a button (this button is actually a sprite i m using ccTouchesEnded! ) i save text field's value in database, but whenever i access the value i am getting nil. if i initialize the textfield value by some string, it always give me only t...

how to release presentModelViewController stack in iphone?

Hi, I m Copying my code here below :- -(IBAction)referencewindow:(id)sender { frmReferences *reference = [[frmReferences alloc]initWithNibName:@"frmReferences" bundle:nil]; [self presentModalViewController:reference animated:YES]; } There are number of places I m using presentModelViewController and my problem is that stack s...

How to set the position of a sprite within a box2d body?

Basically I have 2 polygons for my body. When I add a sprite for userData, the position of the texture isn't where I want it to be. What I want to do is adjust the position of the texture within the body. Here's the code sample of where I am setting this: CCSpriteSheet *sheet = (CCSpriteSheet*) [self getChildByTag:kTagSpriteSheet]; CCSp...

Cocoa Code Error

Hi All this code Iphone SDK 3.0 version or later cell.textLabel.text = [[menuList objectAtIndex:indexPath.row] objectForKey:kTitleKey]; but it gives error request for member 'textLabel' in something not a structure or union I also try cell.text = [[menuList objectAtIndex:indexPath.row] objectForKey:kTitleKey]; but also not workin...

action won't run on a CCSprite from within ccTouchBegan in cocos2d for iphone

Hi, I'm trying to basically scale up a button as soon as a touch is detected. Here's my Scene: @implementation HomeScene -(id) init { if((self = [super init])) { ... // sp_btn_story is retained... sp_btn_story = [[CCSprite spriteWithFile:@"main_menu_btn.png"] retain]; sp_btn_story.position = ccp(size.width - 146, 11...

convert an array of NSValues / CGPoints to a CGPoint struct for use with glDrawArrays in cocos2d

Hi there, I'm pretty new to Objective-C and even C in general here, so please bear with me. My main goal is to display my NSMutableArray of CGPoints (via NSValue) with glDrawArrays(GL_LINE_STRIP, 0, points); I noticed that cocos2d requires an array(?) pointer *poli like so: void ccDrawPoly( CGPoint *poli, int points, BOOL closePolyg...

How to find value of timer in cocos2d iphone

I am doing a simple stop clock like game. The game consists of a timer for 60 secs I attain it by AtlasSpriteManager *mgr = [AtlasSpriteManager spriteManagerWithFile:@"bringit_timer.png" capacity:10]; [self addChild:mgr z:5 tag:2]; AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(0,0,33,200) spriteManager:mgr]; ...

Iphone App Crashes - But sometime works(50%-50%)

Hi All I am using following code for showing a next view(tableview) in Iphone app. It sometime works and some time app crashes without any exception log NSLog(@"Ok"); is log everytime 50% attempts application crashes -(IBAction)statusInitiationButAction:(id)sender{ @try { NSArray *tempArrIniId = [eventInitiationArray v...

iPhone, How to show alter dialog on Lock Screen?

I see some apps like 'Lock Calendar' that include this feature, and I know that we can maybe use keyWindows to trace the view and replace the wallpaper etc., but I feel that if the app makes use of this it will probably be refused by Apple ... or maybe the sdk has provide other API for this purpose? any tip will be appreciate ... Tha...

In cocos2D how to write a selector for a sprite.

Hello, I got problem in cocos2D application. I have a sprite and text in one screen. The text should be able to move up/down when we swipe. And when we select on the sprite it should take to next scene. So, both should have the istouchEnabled to YES. But text should take the touchesMoved and sprite should take touchesEnded. But my proble...

AR-iPhone -> cocos2D?

Hi everyone, I am currently planning a little sightseeing-app (game) for my iPhone. It should be something like geocaching with Augmented-Reality features. The user should search and then pick up virtual elements. These elements should be "stored". Would you recommend using cocos2D for this? I am a programmer with no iPhone programming...

How to get objects to react to touches in Cocos2D?

Alright, so I'm starting to learn more about Coco2D, but I'm kinda frusterated. A lot of the tutorials I have found are for outdated versions of the code, so when I look through and see how they do certain things, I can't translate it into my own program, because a lot has changed. With that being said, I am working in the latest versi...