cocos2d

Using iterateFunc to call objective c method

Using spacemanager, I need to perform an action on select bodies after each step, so I figured that defining my own C function for iterateFunc would be the way to go. Everything works great, except I'm not sure how to then call an obj c method in the same class. In other words, an obj c class contains both the c function replacing itera...

Cocos2d on iPad at native res and not inside box

Hello all, So I can't seem to get my cocos2D app to run at native resolution on the iPad. All it does it run in the little box as if it's an iphone application. I have the latest version of cocos2D inside my app and used the templates to create the project. Any ideas? Cheers ...

how to make a sprite goes behind another sprite

I'm using CCSprite to redraw my app's background image (it's like a moving background). However I'm also using CCSprite to draw my hero and enemies. At some cases the enemies goes behind my background image. My understanding is that if you do: [self addChild:sprite1]; [self addChild:sprite2]; Then sprite1 will be behind sprite2 if the...

how to connect facebook sdk with cocos2d

hi all, As we all know face book is providing SDK to add face book in our applications. In simple applications it's easy to add such sdk as all things are known, but how to add face book sdk in cocos2d applications. I am new to this thing, so if any one can help me out , how to add face book adk with cocos2d?? I've done the same in si...

Is it possible to use xib file in cocos2d

Hi all, I am creating application in cocos2d, but one thing I would like to know is it possible to use xib file in cocs2d as we are using in simple iPhone application creation? If yes then how to make call to such xib files, can any one tell me the answer, is is possible or not? Thanks in advance. ...

iPhone - Drawing 2D Shapes

Hi guys! I have an array of 2D points which make an irregular polygon. What I want to do is draw the borders of it and then fill it with a color. I am using Cocos2d to code the game around, but I have not found a fill function in Cocos2d, only the ccDrawLine and such. Is there a simple way to draw filled shapes in Cocos2? I have ...

How to make my Cocod2d game universal?

Hello, I just finished my new game using Cocos2d (v 0.99.1) for iPhone. Before releasing it on the AppStore, I would like to make my app universal so it can run fullscreen on iPad. What are the changes I need to do to my App? Thanks ! ...

how can i add image from one scene file to another scene?

Hi. I have used cocos2d and i have 2 scene. in first scene i have one image and one menu button. if user will click on menu button then i am showing second scene with some options. now i want like if any user will click on any option in 2 scene then first scene should be come with new image. Can anyone say me how can i change it? i ha...

RunWebThread taking up 33% of CPU time on iPhone App

I'm making a game for the iPhone using Cocos2D. At the beginning of the game, when there are few sprites, the game runs fine, but when there are many sprites on the screen, the game gets choppy. I've profiled the app, and RunWebThread seems to be taking up 33% of the cpu time. I contact a server at the beginning of the game, but there...

Supporting different orientations using Cocos2d on iPhone

I’m trying to support both landscape and portrait orientations in my iPhone Cocos2D game, but I’m having trouble getting the coordinates to translate properly. Here’s what I’m doing so far. I have a GameWorld layer that I always keep in portrait, regardless of the device orientation. The following code is in my DeviceRotated event f...

Cocos2d Sprite performance with bitplanes

Is it possible to improve performance drawing sprites by reducing the number of bit planes used in their image file? For example if you only used 4 colours and hence image was 2 bitplanes, would cocos2d show and manipulate these quicker than a 24 bit colour sprite? ...

cocos2d and box2d .. creating map and worlds

So my question is really about creating different levels in my game. I am using cocos2d and box2d and right now I have a lot of code that actually constructs my world and I can't do pane or stuff like that coz honestly i don't know how.. So any tips and pointers for beginner to create world with static object and then I can add my own ...

recommended image resource to display sprite

I have some images which I would like to use as sprites in my game. What is the best way to do this. I know .png , but Should the background be white, black, does the image, e.g. the character image , need to be "cut" out along its edges? Thanks in advance. ...

Cocos2D iPad Vector Sprites/Spritesheet creation

Hello everyone, Is there a way to load vector graphics into the iPad using cocos(or some other method) as sprites or sprite sheets but leaving the images as vectors and not textures? The reason being is we have an animation that is just way way too big to load in as a texture so we want to scale it down using a vector image. If this is...

cocos2d CCSprite additive blend on a non black ground?

I have setup some CCSprites and enabled additive blending on them. [sprite setBlendFunc: (ccBlendFunc) { GL_ONE, GL_ONE }]; Now they look really nice dropping into the scene if I set my CCColorLayer to black [super initWithColor:(ccColor4B){0,0,0,255}] However I don't want a black background, if I set this to say a light grey then ...

What mathematics is needed for a lunar lander game?

I'd like to build a game to learn cocos2d. Lunar lander is the first exercise coming in my mind. Any pointer/source code/tutorial of the physics calculations required will be appreciated. Thanks! ...

How to detect shake event in cocos2d?

I want to detect shake motion in cocos2d for iPad. I found a promising article about it and tried to implement it but failed. http://www.softvelopment.com/index.php/blogs/2010/03/19/3-adding-shake-recongnition-to-cocos2d-iphone-library- Specifically, I'm not sure where I should put the listener. And moreover, is there any other good w...

Cocos2d-iphone,not calling dealloc when replacing scene

This is a simplified version of the problem I'm facing now. I've made 2 empty CCScene 1 & 2 and added CCLayer 1 & 2 onto their respective scene. I also added an touches function to switch from scene 1 to scene 2 using CCDirector's replacescene. However, dealloc was never called during the replace scene. // scene & layer 2 are exactly t...

Differentiate Drag and Touch in cocos 2d iphone

Hii I have an issue in drag and touch an image. I have 3 images. Let it be left, right and middle. Initially middle image is shown in screen1. If i touch that image, it should open in a new screen(2). If i drag right side, it have to show right image in that screen itself. otherwise If i drag left side, it have to show left image in that...

False order when reading Dictionary from PList

Hi, I have a plist from which i am trying to access its animations in sequence (as defined in the PList) but when I store it in NSDictionary and then try to play animation one by one it is not playing them in sequence. e.g, int index = 0; [self playAnimation:[animTypes objectAtIndex:index++]]; [self playAnimation:[animTypes objectAt...