cocos2d-iphone

Cocos2d: Detect touch on rotated sprite?

How would one detect a touch on a rotated CCSprite? I am familiar with the general technique of using ccTouchesBegan and contentSize, anchorPoint etc. to have a sprite detect if a touch was within its bounds ... but I am not sure how to proceed once the sprite has been rotated by some angle. I want the sprite itself to detect the touch...

Use Chipmunk body location to drive Cocos2D Parallax.

Hello. I'm using Chipmunk with SpaceManager inside of Cocos2D. I have a body which is moving around with impulses, I'd like to be able to use that bodies location to drive a parallax node in Cocos2D. So, when body 'a' moves to the left, the parallax follows but with a small time offset, or elastic effect. If you know AS3 and Flash, y...

I need a strategy for developing graphics for a Cocos2d-iPhone project.

My little game project is a physics based platform jobbie created with Chipmunk (via SpaceManager) in Cocos2d. I wanted something a little different to the a-typical tile mapped level design, so I'm creating levels as SVG files in Illustrator, which I then parse to create the landscape, platforms, spawn points etc etc. It's working pre...

Chipmunk body move with Parallax?

Hello. I'm using Cocos2D, SpaceManager and Chipmunk. I have a parallax node with 4 layers on it, this is tied to the location of a playable chipmunk body. This body needs to collide with static objects on one of the parallax layers, the static bodies must start off screen then move into screen and collide. I know you are not supposed...

problem passing parameters to methods

Hi. I try to call a method with a float parameter but the value the method gets is not what I sent. Here is the code for the call (the actual call is the last part of the last line, [child setFaceDirection: direcao]; ): direcao = dirRadianos * 180 / M_PI; // direcao = The value I send NSLog(@"Value Sent: %f", direcao); // Log what ...

detect movements of objects on iphone by blowing air

hi all. I was just finding something on web I come to know that we can provide movements to different objects by blowing air on iphone from mouth. I tried but could not get how to do such things. so do any one know that how to move objects by blowing air from mouth. If any one do have any idea please tell me. If I am now wrong then...

How to change the size of the image taken in camera

I want to use photos from photo library in my game. How to make the file to be of size 280x280. Is it possible to take the picture (captured by the camera immediately without saving) and then modify the picture and want to save ...

support of Cocos2d-iphone for iPhone 4 high res

Hi all, I'm trying to create a relatively simple game with 2D graphics which has somewhat complicated animations. I tried to develop the game with the basic Core Graphics and Core Animation libraries but the animation performance of the game objects is not satisfactory (i.e. jerky/delayed). So, I am now looking into Cocos2D which looke...

How to differentiate between iphone4 and iphone 3

Hi All, I am trying to build a game for the iphone using cocos2d engine. I wanted to know how can I tell a difference whether the user is using iphone 4 or iphone 3 as I wanted to load hi-resolution graphics for the iphone4 and low-resolution for iphone 3. I know if I use @2x.png at the end of the image file name UIImage loads the hi-re...

How do you redirect from an app, to a webpage?

Hello, I'm creating an app for the Iphone and i'm using Cocos2d. As part of the help menu, i want to redirect the user to a site when they click a link. Is it possible to do in cocos2d? Thank you! ...

What is the best way to set up menus with cocos2d?

I'm new to development and I have played around with a few tutorials. I wonder what the best way to set up a menu for a game with cocos2d? I want a MainMenu with a Startbutton, SettingsButton, HighScoresButton and a little info/creditsButton in the corner. How should I set this up? Should I have the MainMenu as a Scene and the others ...

Trouble with sprites (loading and removing)-cocos2d iphone

Basically i have an array of Sprites to be loaded and removed one by one in an order. I have a list of animal names in an array like const NSString *Animal1[30] = {@"Lion .png",@"Zebra .png",........... To load a sprite i use the following code image[i]= [Sprite spriteWithFile: [NSString stringWithFormat:@"%@",Animal1[i]]]; image[i]...

Cocos2d: Clipping Question

Hi, What is the recommended way to do basic clipping with cocos2d? I am developing a tab control for an educational product and I want the items on a tab page to be clipped by that tab page. So any CCSprites on the CCNode that IS the tab page should be clipped to that CCNode? Any help would be appreciated ... ...

How to change the font size of labels and buttons in UIAlertView

when i put my game in ipad, the alertview seems to be very small. Is it possible to change the fontsize and increase the width and height of the alertview. ...

How do I animate clouds?

I have 3 nice and puffy clouds I made in Photoshop, all the same size, now I would like to animate them so they appear like they were moving in the background. I want this animation to be the base background in all my scenes (menu,settings, score, game). I'm using cocos2d, I have setup the menus and the buttons so the work but how do I ...

IPhone SDK: detect which touch came first on a 2 touch max application

Coding inside the function -(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event receiving 2 touches in the "event" variable, how can one detect which touch has lived longer? i know i could use global variables and in the touchbegin just update these variables, but I rather do it the better way, if there is any. ...

Cocos2d: Solid color rectangular sprite??

I must be missing something! I want to create a solid rectangular CCSprite with a background color initialized to a particular RGB value. I have looked all over the docs and can't find anything. Is there a way to initialize the background of CCSprite to a specific color? I don't want to have to include a solid color PNG for each color...

iPhone:Move a ball according to shake and bounce the ball on edge

HI, I want to develop and app where a ball will be moved according to the direction of shake.The ball also bounce when it reach on edge....just like real world tennis ball....please give me initial idea....i want to go with cocos2d....can it help me..... Thanks ...

How can I use more than one sprite sheet? cocos2d/iPhone

Hi all. I'm trying to use more than one sprite sheet because I can't fit them all on one and having two makes my ordering them easier (sprite sheet one sprites are in the back and have a lower zOrder). I'm currently doing: spriteSheet1 = [[CCSpriteSheet spriteSheetWithFile:@"spriteSheet1.png" capacity:3] retain]; [[CCSpriteFrameCache sh...

Add Chipmunk body to Cocos2d Parallax Node?

Is it possible to add a Chipmunk body to a Cocos2D Parallax node/layer? I have looked at everything I can find, and tried everything that makes any sense (or not). I simply cannot do it, the standard syntax throws errors and I'm not aware of another way to add objects to a parallax node other than [myNode addChild:myBody etc]; Any ide...