cocos2d

Cocos2D game element design

Hey Guys, My question is as easy as that: What is the best method to create character for example in Cocos2D? Here's an example: I want to create an enemy of my "Ninja". The enemy has a strength of 0.5 and a speed of 50. How would you implement this? A subclass of CCSprite or CCLayer or something completely different? I tried with...

Running Instruments on the iPod Touch Device

I am trying to run Instruments on my iPod touch. I have the iPod Touch connected to the device. I fire up the Instruments and select the target as "iPod Touch" then I choose the target to be "myappname". This fires up the app but the app is stuck on the cocos2d default home screen (the cocos2d logo). When I run the application on the dev...

In Cocos2d/OpenGL-ES check pixel of previous draw ?

I'm drawing some lines in cocos2d (using handy ccDrawLine), nothing fancy, but i want to check if my animated line hits something. I could do some math calculations for some objects, but for some dynamic parts in the scene it would be much easier if i could do: if pixel not black at (x,y) // line will hit something do handleCollisi...

Cocos2D on Windows with what programming languages?

I was under the impression that the Cocos2D game framework was just for the iPhone. Now I see that they have a separate project supporting OS/X, Linux, and Windows. It isn't immediately obvious from their web site what languages are options for developing with the framework on these various platforms. There is an installation requirem...

Cocos2d schedule method in NSObject

Hey Guys, It's me again with a Cocos2D problem. :-D I create the main character of my upcoming game as a sublclass of NSObject. This class has a property for the Sprite, Spritesheet and all that stuff. But now I have the following problem. I want to schedule a method for animating the sprite. That action which should be scheduled ever...

How to load an animation from a tiled spritesheet in cocos2d/pyglet

I have a tiled spritesheet saved as a png image that I want to load as a pyglet.image.Animation. I can see how to load an animation from a gif or a series of images, but I can't even figure out how to preform image slicing on images. ...

cocos2d button click boundary problem

i am new to iPhone and cocos2d in general, i m reading tutorials and tried to come up with application that contains a menu i m using cocos2d menu items the problem is that i found while testing my applications that the buttons respond to clicks on some area around the button (not only the button sprite rectangle boundary), and while ...

The best way to remove a sprite from a batch in Cocos2D

Hello, I'm using Cocos2D in my project and I'm quite new to this library. And I don't understand one thing. I have many sprites on the scene which are added and removed constantly. So at certain moment a sprite becomes useless and I have to remove it form a batch node. In the comments of the removeChild method of CCSpriteBatchNode clas...

Cocos2d Adding Menu to the Scene

I have a scene called CongratsScene which is loaded something like this: [[CCDirector sharedDirector] replaceScene:[CCFlipAngularTransition transitionWithDuration:0.8f scene:[CongratsScene scene]]]; For some reason I am not able to add the menu to the scene. Here is the code: +(id) scene { CCScene *scene = [CCScene node]; ...

No memory leaks, yet still running out of memory?

In my cocos2d application I have run through it using instruments and removed all memory leaks. I have my game outputting how much memory is in use on the screen and it is constantly rising as the game progresses until I eventually run out of memory. The amount of objects on screen doesn't increase by very much each level. Its a fairly s...

iPhone - Problem switching scenes in cocos2d (EXC_BAD_ACCESS)

My AppDelegate makes the following call to start my game scene: [[CCDirector sharedDirector] replaceScene: [HelloWorld sceneWithResponseDelegate:self]]; When the scene is finished it adds a MenuLayer (which is a singleton): MenuLayer *menu = [MenuLayer layerWithLevel:@"forest" score:score responseDelegate:mainMenu]; [[[CCDirector sha...

How many times do I release an allocated or retained object?

Hi, I am making an iPhone game. I want to release all the object that have been allocated or retained. In the dealloc function I am releasing all such objects but then realized sometimes i end up releasing objects when they have not been allocated yet. So I figured I need to check if its retainCount is greater than zero or not before i ...

Cocos2d Accelerometer Movement

Hello, I was wondering how you would move a CCSprite right and left by tilting the device right and left. Like in the falling balls app. Thanks in advance, John ...

cocos2d:Convert iPhone App to Universal App

Hi, I have developed an App app in cocos2d 99.4 using cocos2d box2d project template.It works well in iPhone 4,iPod.....but i need it to convert to universal...i mean iPad version also ......i already upgraded it to iPad version....so that it runs in iPad...but in small size like iPhone... can any one help?? Thanks ...

problem with CCRepeatForever

I have an object that moves with CCBezierTo. CCSprite * bedrumotic = [CCSprite spriteWithFile:@"9_bedrimotic.png"]; [bedrumotic setPosition:ccp(100, 800)]; [self addChild:bedrumotic z:4]; ccBezierConfig bezier1; bezier1.controlPoint_1 = ccp(300, 950); bezier1.endPosition = ccp(500, 800); id move1 = [CCBezierTo actionWith...

how do I transition from a cocos2d scene to a uiviewcontroller view?

Hi, Just want to know how to transition from a cocos2d scene to a UIviewcontroller view and vice-versa? thanks, mark ...

iphone: memory effciency in cocos2d 0.82 VS cocos2d 0.99.4

HI, I have a game built using cocos0.82. i want to know that will there be a significant memory efficiency if i upgrade my cocos2d to latest version ? Please reply. ...

Detect the letter being touched...(CCBitmapFontAtlas)

I usd the CCBitmapFontAtlas to display a string and it works fine: label = [CCBitmapFontAtlas bitmapFontAtlasWithString:@"RBT" fntFile:@"bitmapFontTest.fnt"]; [self addChild:label]; CGSize s = [[CCDirector sharedDirector] winSize]; label.position = ccp(s.width/2, s.height/2); label.anchorPoint = ccp(0.5f, 0.5f); Now ...

On CCBitmapFontAtlas effect (Display on by one)

I'm trying to make a effect using the CCBitmapFontAtlas, here is what I want: The string say "ABCDEFG" being dispayed one by one, each one won't be displayed until the one before is completely displayed. And here is what I tried: -(id) init { if( (self=[super init] )) { label = [CCBitmapFontAtlas bitmapFontAtlasWithString:@...

CCMenu animating

Hi, I'm trying to animate my CCMenu. CCSpriteFrameCache * cache = [CCSpriteFrameCache sharedSpriteFrameCache]; [cache addSpriteFramesWithFile:@"PlayButton.plist"]; CCAnimation * animation = [[CCAnimation alloc] initWithName:@"idle" delay:1/20.0]; for ( int i=1; i < 6; ++i ) { NSString * fname = [NSString strin...