cocos2d

cocos2d iphone - game architecture: physics VS. code simulated sprite behaviors

Hello stackoverflow community ! I am trying to figure out how to architect my game using cocos2d. My problem is that cocos2d's physics engine (i'm talking about chipmunk) lies in a world behind sprites. When I move the sprite, I'm wondering if I should *1) be moving it by applying forces on the physics body behind it OR 2) if i ...

iphone cocos2d's chipmunk - Center of gravity

Hello wonderful people ! Here is my problem. I have a chipmunk's rigid body (a soda can standing up) that i want to change its center of gravity to the bottom of the object so it can fall on its flank when a force is applied to its upper part. Am I on the right track? 1) For some reason, I am having trouble setting the body's center ...

As relates to texture atlases, what is a "quad"?

It is my understanding that a texture atlas is basically a single texture that contains many smaller textures and that they are useful for making games or animations faster because they allow you to access many animation frames by loading a single file rather than files for each and every frame. So, in discussions of texture atlases, I ...

cocos2d MFMailComposeViewController

hi, i tried to insert a mail tool in my app.... my app is based on the cocos2d engine the Toolbar (at the top ->cancel,send...) is visible but i can't see the other parts of the mfMailComposerViewController view :-( code: -(void)displayComposerSheet { MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] i...

Cocos2d vs UIKit

When I try to use UIView with cocos2d I have a problem. I create UIViewController, add view to it and add view to window: helpController=[[HelpController alloc] init]; helpController.view=view; [[[[Director sharedDirector] openGLView] window] addSubview: helpController.view]; @interface HelpController : UIViewController { } @end @imple...

[iPhone] presentModalViewController not working

Hi everyone, I'm having an odd issue trying to present an MPMediaPickerController using presentModalViewController. I had it working fine, but recently (perhaps as of 3.1, I don't exactly recall the last time it was working) the MPMediaPickerController just refuses to show itself. The screen just remains black, with nothing but the sta...

How do you do an equivalent scaling call in cocos2d as this Core Animation scale?

I'm looking for something that does a similar call, but using cocos2d... the idea is to enlarge the sprite and then fade it out... Here's is a similar call in core animation: [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:ANIM_NORMAL]; someView.alpha = 0.0; someView.transform = CGAffineTransformMakeScale (3.0, 3....

Using AtlasSprite as a parent class - Giving problems on propreties on the class

I am trying to have AtlasSprite as a parent class but it's giving me errors on propreties. Like it can't seem to find them: Here's the code extract. interface: @interface Glyph : AtlasSprite{ float eyelevel; } @property (readwrite,assign) float eyelevel; -(id) initWithMgr:(id) mgr; implementation: @implementation Glyph @synthesi...

Cocos2d iPhone Non-Rectangular Sprite Touch Detection

Have a project with a TRIANGLE shaped graphic in a sprite. I am arranging these sprites in a grid so that their rectangles are all overlapping. As sprites get touched their z-order is being changed (by me) to put them on the top of zOrder. I am using Cocos 0.8.1 and the touch dispatcher method. I have touches working but obviously the "...

How to add cocos 2d in application? - iphone dev

Hello! I am the "From Scratch / Beginner / new bie - Game Developer for iPhone". I would like to develop a tetris like game in iPhone. I have started with following link. http://monoclestudios.com/cocos2d%5Fwhitepaper.html I am using iPhone simulator 3.0. & xCode 3.1.3. I have followed each step correctly. However error occurs. Don...

ccp & cpv - function difference & full form of cocoa

I have following code in my Application. I am new to game development in iPhone using COCOS. Sprite *bg=[Sprite spriteWithFile:@"menu.png"]; [bg setPosition:ccp(240,160)]; [self addChild:bg z:0]; [self addChild:[GameLayer node] z:1]; } return self; } @end @implementation GameLayer -(id)init{ if(self=[super init]){ Label ...

Releasing a CocosNode and adding its children to Layer in Cocos2d

I'm working on a Tetris clone in Cocos2d for the iPhone and I'm using a Block class of Sprites for the individual blocks and a Tetromino CocosNode class that the user controls in order to move the Blocks. All of these Blocks move around in a 20 by 10 grid of empty Blocks on the GameBoardLayer. When the block finishes falling, I'd like ...

Any chance of cocos2d within MonoTouch?

After learning more about how monotouch works, I believe I know the answer to this anyway, but can you use the cocos2d-iphone framework with monotouch? I believe most likely this will be a 'no', because cocos2d is an an objective c library and there would most probably have to be some sort of .net port for this to be achieved? is that so...

How to know return types of methods in xcode? - iphone development

while typing in Xcode, (objective - c for iPhone dev) Suppose I write [mySprite [[here mySprite is an object of sprite class ( cocos2d - for game development ). ]] After writing this, if I press ## esc ## key. It will show me all the methods. Lets take an example, If I am using [mySprite position]; method, How can I came to kno...

How do I create a floor for a game?

I'm attempting to build a Lunar Lander style game on the iPhone. I've got Cocos2D and I'm going to use Box2D. I'm wondering what the best way is to build the floor for the game. I need to be able to create both the visual aspect of the floor and the data for the physics engine. Oh, did I mention I'm terrible at graphics editing? ...

How to display layer over view?

Hi all, I have one background view, which I added on openglview of cocos2d. I have to display a snow falling effect above that background view so I created one layer, then i created a Scene by using that layer, then run that scene after adding my background view on opengl view. I am expecting that snow falling effect is display over my b...

Problem with textfields and scene transition + cocos2d

I am having problems with my textfield not flowing with the scene transistion. Basically my scene is transition with this call: Scene* gs = [[[QuestionsScene alloc] initWithPage:2] autorelease]; [[Director sharedDirector] replaceScene: [SlideInRTransition transitionWithDuration:0.5 scene: gs]]; However in my init i have a textfield...

Few questions on iphone memory management and cocos2d

I'm working on my first app and have a few questions on memory management. First Question: I'm working on an intro scene that looks like this #import "Intro_Scene.h" #import "Main_Menu.h" #import "Label.h" @implementation Intro_Scene @synthesize logo,label; -(id) init { self = [super init]; if(self != nil) { //Load logo image...

Is it possible to to re-initialize an object in cocos2d

I have a class named insect child of sprite.I have created a instance of that class in GameLayer and then initialize with it using, insect *bgg = [insect spriteWithFile:@"bird2a.gif"]; then i set a timer(10 second) to change the image using *bgg = [insect spriteWithFile:@"2.gif"]; but my program crashes.Now my question is it po...

How to drag layers in sync

I have a layer and several child layer to this main layer. I can drag each child layer separately using ccTouchMoved method. I need to drag the main layer so the other layers will follow, but how Can I drag the main layer through the ccTouchMoved? Thank you. ...