cocos2d-iphone

Cocos2D SpriteSheet animation problem, my number of frames is much larger.

Hello, I am trying to use SpriteSheet to run an animation. My frames are of 320x480 in size each, So I am able to put max 6 frames on the texture image. But my animation consists of frame number ranging from 50 to 200 sometimes, and all are of size 320x480. But this much number of frames cannot be added on the Texture image as the size ...

Implement looped movement animation with tap to cancel

Hi All; My app is based around a grid and an image that moves within a grid that is contained within a scrollview. I have an imageview that I am animating from one cell to another in time with a slow finger movement and recentering the scrollview. That is rather straight forward. I have also implement the ability to detect a swipe and ...

Update Label Value in Cocos2d

hi friends I am making a game in cocos2d , In that while updating score the old score values get on the label and the new value get overwritten. I m using following code to display the score, LblScore = [CCLabel labelWithString:[NSString stringWithFormat:@"%d",score] dimensions:CGSizeMake(100, 300) alignment:UITextAlignmentCenter font...

How to delay my AI move

I am doing a game like chess. As soon my player move is completed(if he starts move from one place to another), my AI move is started (before my player reaching his destination ). Sometimes i find difficult which AI coin is moved now. how to delay it. ...

how can we implement Input Dialog box in cocos2d

In cocos2d how to bring a Input dialog box for getting user name. Is there any way than using view based application? ...

How can we add scrolling text in cocos2d by using UITextView ?

I want a UITextView in cocos2d. I used in init method I wrote the code , UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0, windowSize.height/2,windowSize.width/2)]; textView.backgroundColor = [UIColor clearColor]; textView.text = @"I am First enemy"; [textView setEditable:NO]; [[[CCDirector sharedDirect...

Only Integrating Box2D collision detection in my 2d engine?

I have integrated box2d in my engine, ( Debug Draw, etc. ) and with a world I can throw in some 2d squares/rectangles etc. I saw this post, where the user is basically not using a world for collision detection, however the user doesn't explain anything about how he's using the manifold (b2Manifold), etc. Another post, is in the cocos2d...

Moving a sprite around the circumference of a circle in Cocos2d-iPhone

I am new to Cocos2d. I have taken a look at the documentation at it looks pretty simple compared to what you need to do using basic Iphone classes such as UIAnimation etc. I want to move a Sprite (eg. Bird, Plane or Car) around the center of a circle around its circumference, smoothly so that even the sprite rotates accordingly. How i...

Where do I attach the StoreKit delegate and observer in a Cocos2d App?

I have figured out how all of the StoreKit stuff works and have actually tested working code... however, I have a problem. I made my "store" layer/scene the SKProductsRequestDelegate. Is this the correct thing to do? I get the initial product info like so: SKProductsRequest *productRequest = [[SKProductsRequest alloc] initWithProduct...

How to dismiss the MFMailComposeViewController in cocos2d ?

I have changed my code to this way. Now mail controller is opening in landscape mode. But the problem is If I touch on cancel button or send button the mail controller is not dismissing its view. How can I do it ? -(void)goToFirstScreen:(id)sender { NSLog(@"goToFirstScreen: "); CCScene *Scene = [CCScene node]; CCLayer *Layer...

how to deal with HTTPS connection in iphone

please provide any example or tutorial for the same. I have used SetallowsAnyHTTPSCertificateForHost But it is private API and apple will reject app for it. I have tried to use ASIHTTPRequest but not reaching to final solution. have anyone tried using ASIHTTPRequest with https type url ...

managing images in an iphone/ipad universal app

Hi, I'm just curious as to what methods people are using to dynamically use larger or smaller images in their universal iPhone/iPad apps. I created a large test image and I tried scaling down (using cocos2d) by 0.46875. After viewing that in the iPhone 4.0 simulator I found the results were pretty crappy... rough pixel edges, etc. Plus,...

How to get the location (x,y) of a CCLabel that is a child of a CCScene?

(learning Cocos2D) After creating a CCLabel and adding it to a CCLayer like this: //From HelloWorldScene.m // create and initialize a Label CCLabel* label1 = [CCLabel labelWithString:@"Hello" fontName:@"Marker Felt" fontSize:10]; label1.position = ccp(35, 435); // add the label as a child to this Layer [self addChild: label1]; Ho...

How to stop the horizontal scrolling programmatically ?

I have a UITextView *textView in cocos2d's CCLayer. The text is scrolling in both the horizontal and vertical directions. But, I need it to scroll and bounce only in vertically. How to stop the horizontal scrolling programmatically ? UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(100,200, windowSize.height/2,w...

Do, custom fonts work in UITextView that was loaded in cocos2d layer ?

Do, custom fonts work in UITextView ? I loaded UITextView *textView in cocos2d layer. And I trying to set the font of the text as Copperplate Gothic Bold. I downloaded the font file Coprgtb.TTF. But, the text is not adjusting to this font. The system fonts are working, but the custom fonts are not working ? I added the font file in r...

Cocos2D, UIScrollView, and initial placement of a scene

Hello: I am using a UIScrollView to forward touches to Cocos2D as outlined in http://getsetgames.com/2009/08/21/cocos2d-and-uiscrollview/ Everything works great after a few days of working with it, except one thing: when the initial view appears on the screen, the background appears to be scrolled to the center. As soon as I try to s...

Can I edit cocos2d-iphone template (v 0.99.2)

hey, I am new to iPhone development. I am using cocos2d 0.99.2 templates with xcode. Is it possible for me to make changes to these templates, like removing comments or adding some code? ...

dynamic drawing in cocos2d?

hey, I am working on a game which would take touch gestures as inputs. Now, i would like to display the path/gesture as the user draws it. Can someone please tell me how to do this in cocos2d? I tried to override the draw method and used ccDrawPoint(). But the point just keeps following the touch. I guess this is because the previous ...

Cocos2d: Move a Sprite along a path/bezier ?

Hi I need to move a sprite from one CGPoint to another using Cocos2d for the Iphone. The problem is that the animation should be along a bezier. Basically I would use this : id move = [CCMoveTo actionWithDuration:.5f position:ccp(100,200)]; [sprite runAction:move]; Now how can I do this in a non linear path ? Thx ...

How to create an animated tiled background from a texture atlas with Cocos2d

I want to create a CCLayer with an animated tiled background from a larger texture atlas with Cocos2d. I know how to drop a background in a CCLayer. I know how to create an animated CCSprite. I even know how to handle tiled world maps. But I can't find a proper way to combine all these elements in the desired form. How would I do this?...