Cocos2d for this?
Hi everyone, I just finished my concept for an iphone app. I have a main program and in that program I want to start a game. MAIN PROGRAM (BUTTON 1 / BUTTON 2 / START GAME) | | Cocos2d Game Is this possible? To use cocos...
Hi everyone, I just finished my concept for an iphone app. I have a main program and in that program I want to start a game. MAIN PROGRAM (BUTTON 1 / BUTTON 2 / START GAME) | | Cocos2d Game Is this possible? To use cocos...
I'm developing a line drawing game, similar to Flight Control, Harbor Master, and others in the appstore, using Cocos2D. For this game, I need a CCSprite to follow a line that the user has drawn. I'm storing a sequence of CGPoint structs in an NSArray, based on the points I get in the touchesBegin and touchesMoved messages. I now have t...
Hey there, I am not sure if many of you are familiar with the box2d physics engine, but I am using it within cocos2d and objective c. This more or less could be a general objective-c question though, I am performing this: NSMutableArray *allShapes = [[NSMutableArray array] retain]; b2PolygonShape shape; .. .. [allShapes addObject:sha...
//prog 1 -(void)gameLogic:(ccTime)dt { id actionMove = [CCMoveTo actionWithDuration:1.0 position:ccp(windowSize.width/2-400, actualY)]; [actionMove setTag:6]; [self schedule:@selector(update:)]; [hitBullet runAction:actionMove]; } -(void)update:(ccTime)dt { if ( (CGRectIntersectsRect(hitRect, playerRect)) ) { [[[self getAc...
In cocos2d, I have a CCLayer that is being moved and scaled using touches and pinch gestures. By default, the zoom always goes towards the anchorPoint. Changing the anchorPoint fixes my zoom problem, but causes the sprite to suddenly jump. Here are two similar questions here and here, but I still don't know exactly what to do. Than...
I have a text in my game which is written in cocos2d. The text moves up and down while we touch and move it up or down. The text is moving. But it is not getting to original position while touches ended. So, I wrote cade for touches ended for text to get original position. But problem is i could not read the entire text now. What I need ...
How do I avoid unneccesary deallocation? I'm running this code: CCSpriteFrameCache * cache = [CCSpriteFrameCache sharedSpriteFrameCache]; [cache addSpriteFramesWithFile:@"boosttexture.plist"]; CCAnimation * animation = [[CCAnimation alloc] initWithName:@"boosting" delay:1/24.0f]; [animation addFrame:[cache spriteFrameByNam...
I am trying to generate an NSDictonary that can be used to populate a listview with data I retrieved from an SQL statement. when I go to create an array and add them it adds the arrays for ALL my keys and not just for the current key. I've tried a removeAllObjects on the array but for some reason that destroys ALL my data that I already ...
I am writing an app in cocos2d. I hava a sprite and a text in my scene. I have written two separate classes for sprite and text. And I added both of them to another class. In sprite class I have written - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event And in text class I have written -(void) registerWithTouchDis...
I need to divide a scene in to two layers. So that I can write same methods for two layers. So I may get two functionalities. But can I make that ? Is there a possibility in cocos2d? Thank You ...
I have a body which I move with the help of a button,here is what Im doing -(void) step: (ccTime) delta { int steps = 2; CGFloat dt = delta/(CGFloat)steps; for(int i=0; iactiveShapes, &eachShape, nil); cpSpaceHashEach(space->staticShapes, &eachShape, nil); if(MoveBody) { cpFloat movementPadding = 0.1; cpBodyApplyForce(body,...
In a game with 5 levels, how to save a name, highest score, levels(which currently he is). ...
Hi, I'm trying to write a basic test "game state" singleton in cocos2d, but for some reason upon loading the app, initWithCoder is never called. Any help would be much appreciated, thanks. Here's my singleton GameState.h: #import "cocos2d.h" @interface GameState : NSObject <NSCoding> { NSInteger level, score; Boolean seenInstruct...
Hello to all. I need to attach cc2d Director in different views. After a lot of manipulations I found that I can't use only one instance of EAGLView that is present in [Direcor sharedDirector]. So, I have done some changes, and now I use a separate instances of EAGLView for each view. The problem I am trying to solve, could be describe...
I just have a simple sprite - how can I get it to rotate? A good answer would show how to rotate both a dynamic sprite and a static_mass sprite ...
I have two static (STATIC_MASS) SpaceManager sprites. One is a child of the other - by which I mean that one sort of builds up the other one, but although the child's images shows up in the right place, the child doesn't seem to exists in the chipmunk physics engine, like I would expect. In my case, I have a backboard (rectangular spri...
If I have two objects in chipmunk (I'm using cocos2d-iphone), once I've detected that they collided, how can I tell how hard they are hitting each other? I want their force (vs. the velocity) to know the damage of the collision. I've seen discussion about how to do this, but never concrete working code (and I couldn't get it work, ev...
My problem is that whenever I change the texture of a sprite, the new texture will retain the size of the original sprite's texture. I have this code: mySprite = [CCSprite spriteWithFile:@"mySprite.png"]]; ... // change current stage here CCTexture2D *newTexture=[[[CCTexture2D alloc]initWithImage:[UIImage imageNamed:[NSString strin...
There are no good instructions for installing cocos2d for iPhone on the mac. I downloaded the current build from git, a folder called "cocos2d-iphone-0.99.1". i put this folder in /Developer/Libary. Q: is this right? I tried running the file called "install_template.sh". it said the templates were already installed. Instead, I manually...
Hii, I want to calculate time taken by the player for making his move. My player can pick his coin and make his move to a box(like in chess). If my player pick his coin early but make his move very lately, then how to calculate time between AI and player move ...