cocos2d

Cocos2d adding a background image to a layer?

Hello, I just finished reading some of the cocos2d documentation, and as far as I understand to add a background image to a layer you have to do something like: Sprite * bg = [Sprite spriteWithFile:@"Background.png"]; [layer addChild:bg z:0]; Allthough as far as my testing goes you can just directly add the sprite to the scene like t...

iphone-cocos2d: 0.9 & 0.8.2 slower than 0.7.1?

I have a code that set's a bow's angle according to where you have touched the screen. a simple "bow.rotation = X" command is performed on the ccTouchesMoved event. the problem is, that while running the code on 0.7.1 of cocos2d against 0.9 or 0.8.2 it worked way better, in 0.9 and 0.8.2 it seems like it skippes some of the touchesmove e...

Cocos2d and chipmunk how to simulate depth?

Hello, I am developing a game that intends to toss an object but instead of having it being tossed horizontally I would like to simulate it being thrown along the imaginary z axis that is simulate depth in my game. Something like the nintendo duck hunt game. Can someone point me in the right direction to implement this?. My first idea w...

Cocos2d on application start gives random fps drop?

Hello, I am developing an iphone game using cocos2d and have it set to to show the FPS. Now most of the time the application will start and run at 60 fps, However apparently randomly sometimes the application will start and top at only 40 fps. This does not happen often and seems to happen only when you quit the application and restar...

Projectile Motion calculation with chipmunk dynamics.

I need to implement a little bit of Ai that can apply an impulse to a rigid body in order to hit a target. Like a cannon ball being fired from a cannon. I'm using Chipmunk Dynamics for the physics engine. My maths is terrible, as is my physics, but i've been reading up, and with a little help from SO and the following from this wikipedi...

Iphone I am using cocos2d and need the rgba value of a pixel on a sprite

I am programing a shooter game in cocos2d for the iphone. I and I want to exclude collision detection an the alpha of my sprite. How do I read the RGBA value of the single pixel. Thanks for the help. ...

Chipmunk collision detection

Hello, I am completely new to chipmunk and I have just been using it for a few days, so I'm guessing this is something pretty obvious, however I cannot find any documentation for this. Is there any callback or method in chipmunk that tells you that 2 given shapes have collided?. If not is the best way to simply use cgrectcontains on th...

Problem animating a Parallax Layer in Cocos2d-iPhone

UPDATE: I'm a doofus. What's happening is obvious. The Animation first sets the layers position to it's current position. But I've told the layer to divide any setPosition coordinates by pRatio. So it's not going to CGPoint(0,0) but something like CGPoint(0.032, 0). I've fixed it like this: - (void) setPosition:(CGPoint)point { if(!...

How to set up loading page in iPhone game.

Hi everyone. I have some trouble with my game (using Cocos2D). I have an introduction, then it will go to the game afterward. The thing here is, on the simulator, it always appears at real-time when it switches scene Intro to GamePlay. But in the actual phone, I know it would be slower and take more time to switch. But before the player...

Customizing Cocos2D menus

I've decided to stick with cocos2d for game dev... For the menus it there a way to make it more customizable, like maybe instead of text maybe an image then is there a way to arrange them differently versus just in the center of the screen ...

Cocos2d 0.8.2 (from 0.7.2)

I am switching from cocos2d 0.7.2 to 0.8.2 for cocosdenshion, but now i get 7 errors! Undefined symbols: "_OBJC_IVAR_$_TransitionScene.inSceneOnTop", referenced from: _OBJC_IVAR_$_TransitionScene.inSceneOnTop$non_lazy_ptr in PageTurnTransition.o "_inflateEnd", referenced from: _inflateMemory_ in ZipUtils.o _inflateMemory_ in ZipUtils.o ...

add rotation for the iPhone game

Hi everyone. I built a game using Cocos2D. And my game has no rotation. So how can I implement rotation for my game? please help me out. Thanks in advance ...

Is there any event trigger after releasing the button press for MenuItemImage in cocos2d?

Hello, I am working on a cocos2d iPhone app and want to capture the event after releasing the button press. Will there be any event or notification triggered after releasing the button click. I know when clicking a button we will get notified based on the selector function provided, but after click is finished and releasing the button p...

resetting to intial value

Can anyone please tell me how to reset a multiplexlayer scene in cocos2d I want the position, score , time to be reset to intial value. can anyone please tell me how to do it ...

How to distort a Sprite into a trapezoid?

Hello, I am trying to transform a Sprite into a trapezoid, I don't really care about the interpolation even though I know without it my image will lose detail. All I really want to do is Transform my rectangular Sprite into a trapezoid like this: / \ / \ /__________\ Has anyone done this with CGAffineTransforms or...

How can you save Cocos2D window output as Video?

I am considering using the excellent looking Cocos2d for a motion graphics project. However, Cocos2d is intended for games, rather than producing an MPEG stream. Is it possible to save the output from a Cocos2d script to a MOV or MPG file? Ideally this needs to be done in a direct manner, not using a screen capture as this would not mee...

How do I animate a sprite using cocos2d?

I have a sprite which will move right,left and jump. I need to add the action to a animated sprite ie an animated sprite should jump, turn right and left. Can anyone please tell me how to do it with sample code. ...

Cocos2d + Box2d or Chipmunk

OK, im trying to make an iphone version of a game i made here http://scratch.mit.edu/projects/techy/781198 is box2d or chipmunk better and where are some tutorials for each one ...

Is it possible to achieve MAX(As,Ad) openGL blending?

I am working on a game where I want to create shadows under a series of sprites on a grid. The shadows are larger than the sprites themselves and the sprites are animated (i.e. move and rotate). I cannot simply render them into the sprite png, or the shadows will overlap adjacent sprites. I also cannot simply put shadows on a lower la...

Does cocos2d framework work on iPad?

Does Cocos2d iPhone framework work on iPad? My guess would be yes, but wanted to check if someone has a definitive answer after porting iPhone project with cocos2d to iPad, or starting a new one. ...