cocos2d

Cocoa: Problem passing a CGPoint with NSNotification and NSDictionary

I'm trying to fire a Notification in a method called setPosition in one class, that triggers setViewPointCenter in another class. However, I'm trying to send a CGPoint along with it. But Xcode isn't liking it one bit. -(void)setPosition:(CGPoint)point { NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:@"sp", poi...

Text Typing Effect in iPhone cocos2d Game

In many games, when a character is speaking (dialogue), the text has a typing effect, where it looks like you are watching the character type the text. What would be a good way to achieve this look and (simple) "animation" for an iPhone game which uses cocos2d? It's good if there's a way to do it with cocos2d, but I'm not completely op...

cocos2d flaoting around sprite in Menu

hello , i have a menu in cocos2d game and i want to have a sprite in the backgrounf that is floating around and bouncing from the walls randomly (like a screen saver), what is the best way to do this? thank you! ...

How can I detect a permanent collision with the Chipmunk Physics engine

I'm trying to play a "boing" sound when a ball shape hit's any other kind of shape. Which works. But works a little too well.... When the ball comes to rest, or starts to roll, it's in a permanent collision with whatever it's touching, so the "boing" sound fires constantly. I can't find anything in the chipmunk documentation to tell m...

How can I get an OpenGl texture of a polygon shape from an image?

I have an image and a convex polygon defined by an array of x,y coordinates. How would I go about getting a Texture2D representation of the part of the image encompassed by the polygon? Basically I just need a texture from the image with the part outside the polygon made transparent. If the resultant texture were also clipped to the...

cocos2d in iphone z order

Hi guys, I am working on a game with many sprites in a layer, and once you touch the sprite, it will do something. my problem is the z order issue, most of my sprites are overlapping and when you touch the overlapping sprites, the one behind(i think with the lowest z order) react instead of the one in front. I need to understand more ...

moving many sprites at a time without using scheduler

i m developing an application. In which i have to move sprites on click event. problem is i have to move 2-3 images at a time on click n also check collision. so i created class of that sprites n wrote moving functions as member function. but i m not able to use scheduler in that file. so its again move 1 sprite at a time. so i want to w...

Two Sprite play the same action at the same time,the first one doesn't work

- (BOOL) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { CocosNode* spHead = [self getChildByTag:tagHead]; CocosNode* spBody = [self getChildByTag:tagBody]; [spHead runAction:fadeOutAction]; [spBody runAction:fadeOutAction]; } as the code above, i want the sprites to do some action at the same time, the second one wor...

Loading AtlasSpriteManager in background threads are not working..

Hi, I am doing a iPhone game using cocos2d that involves a huge set of character animations (atleast 25 different of them).. for which I am having a lot of spritesheets each weighing around 100KB to 200KB.. And I used to create the AtlasSpriteManagers for these on-demand. But when I tested this in the device, there was lotsa performance...

cocos2d delegate question

in the main.m file: int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [NSAutoreleasePool new]; UIApplicationMain(argc, argv, nil, @"AppController"); [pool release]; return 0; } I just add the cocos2d sample test code to my project, and there're so many AppController delegate in those files. So how can I know which "AppCon...

What's the best practice in cocos2d to redirect an animating sprite?

I am making a game where 'defending' sprites need to animate towards 'attacking' sprites. But for example an attacker might change course to attack something else, mid animation. What's the best way to manage animations, and destinations? I believe I must remove any action on a sprite before adding a new one. Perhaps I need to use the s...

how load paused scene again in cocos2d?

i have 3 scenes first is main game scene. when i pause that scene i replace it with other scene and then other view is loaded.ie. main menu so when i click on continue button on that scene i have to resume main game scene but it shows 2nd scene with which i have replaced the game scene.idnt knw what to docoz i haveused both viewsand scen...

COCOS2D:How to call a nib file from cocos menu and vice versa?

Hi Devs, I m developing a game where all the settings page, score page, help pages are in nib formace and the game is in cocos2d scene format (Gamescene.h and m file). So i need to call the game scene of from a nib file when "Start game" button is pressed from the nib. And when the game is over , i need to call the score .nib from the ...

Objective-C, sorting an array based on a objects instance variable.

I'm working on a game like Rodents Revenge, just to point out where I'm coming from with this question. I'm using the cocos2d game engine aswell... I have a layer that contains about 168 blocks, these blocks are a subclass of a Sprite. Each block contains two instance variables that are integers, one for the xGridLocation and yGridLocat...

can moving many sprites using scheduler in one scene slow down simulator

I am developing a game in which i have 10-12 sprite moving at a time in one scene can that slow down the simulator? in my game if i click on sprite moving at top i.e. plane from which humans jump down. so if one click continuously 6 or 7 times at time 6 or 7 sprites appear and it slow down. i have not tested on iphone but its slow down's...

Missing sounds in cocos engine!

Hello guys, today i took some problem with sounds... I made video before 1st lvl of game, Why after playing the player (with video) in cocos sound engine, game missing sounds (buttons sounds etc) But music work good. ...

Generating graphics at runtime with Cocos2D - How to display?

I'm trying to create dynamic graphics for my game, which I'm building with Cocos2D. The graphics generation will occur at predictable, finite points, such as level loading. I'm having a hard time figuring out how to actually draw this at runtime. From what I can tell, the easiest way would be to draw into a PNG file at runtime and then l...

Problem using chipmunk

I made a game that using a character that can moving left or right by touching the screen, above the character, it is a apple, what i need is the apple will fall down, the character may push the apple up again just like playing volleyball. That's the problem,what i have learnt from "bounding ball" is give a sprite a shape and body, then ...

How to implement moving platforms with Cocos2d, TMXTiledMaps and Chipmunk

I'm making slow but steady progress with a Cocos2d game, but I'm stuck creating moving platforms. The main character needs physics and collision detection, and is therefore a chipmunk shape/body. I wrote a class to iterate over the TMXTiledMap in order to cut back on the amount of bodies in the chipmunk space. So with a map like this ...

Dragging a particularly large sprite up and down like scroll effect in COCOS2D

I am really stuck on this. My application is in landscape view and on one screen i wanted my instructions image to be scrollable. I have added this image as a sprite. First i tried to get scroll effect available from other sites, but soon i saw that scrolling was being done for the complete screen and not the sprite image. Then i resorte...