cocos2d for iPhone is a free open-source framework for building 2D games, demos, and other graphical/interactive applications for iOS devices.

learn more… | top users | synonyms

0
votes
1answer
553 views

what is the difference between CCSprite and a PhysicsSprite?

I am new to Cocos2D and I've realized that most of the codes written before the Cocos2d update used CCSprites. Recently I realized a lot of more recent codes after the update are using PhysicsSprite. ...
2
votes
0answers
380 views

how to attach a body to a rope and making it swing to another rope [closed]

I've set some ropes (using cocos2d and box2d) and would like to attach a body to one rope in such a way that it can swing to another rope. I am not sure how to go about this. I read making and object ...
0
votes
1answer
467 views

How do I manage the visibility of enemy spawn locations in a long scrolling shooter?

How do I handle the situation of an enemy spawn place being visible on a screen in a scrolling shooter? The tutorials I have seen are about setting all the enemies on a whole map only. But it is not ...
0
votes
1answer
264 views

Why set the position of both b2Body and Box2DSprite?

In a game, we add a body for each sprite, the method is: createBodyAtLocation:(CGPoint) forSprite:(Box2DSprite*)sprite In which we create the body and we attach it to the sprite in parameter: ...
0
votes
1answer
257 views

Player sprite moving slower on iPhone 4

I just finished getting movement/jump animation for a player sprite in Xcode using Cocos2D. The basic movement algorithm is a timer that updates every 0.01 sec, changing the sprite position to ...
3
votes
5answers
840 views

Should iOS games use a Timer?

No matter what frameworks we use -- Core Graphics, Cocos2D, OpenGL ES -- to write games, should a timer be used (for games that has animation even when a user doesn't do any input, such as after ...
4
votes
1answer
1k views

How do I break an image into 6 or 8 pieces of different shapes?

I am working on puzzle game, where the player can select an image from iPhone photo gallery. The selected image will save in puzzle page and after 3 second wait the selected image will be broken into ...
2
votes
2answers
923 views

Basic game architechture best practices in Cocos2D on iOS

Consider the following simple game: 20 squares floating around an iPhone's screen. Tapping a square causes that square to disappear. What's the "best practices" way to set this up in Cocos2D? Here's ...
0
votes
1answer
566 views

Thread-safety in Cocos2d-iPhone?

After tinkering a bit with cocos2d, I discovered that there is no classic game loop and everything is more-or-less event driven. I guess I can wrap my head around that, no problem. But I cannot find ...
1
vote
0answers
377 views

Zoom Layer centered on a Sprite

I am in process of developing a small game where a space-ship travels through a layer (doh!), in some situations the spaceship comes close to an enemy space ship, and the whole layer is zoomed in on ...
1
vote
0answers
155 views

How do I control an animation with a drag command?

I want to play an animation when someone drags a sprite from it's default position to another selected position. If they drag half of the selected position then animation will be play half. For ...
7
votes
3answers
3k views

How to achieve uniform speed of movement on a bezier curve?

I'm trying to move an image along Bezier curve. This is how I do it: - (void)startFly { [self runAction:[CCSequence actions: [CCBezierBy actionWithDuration:timeFlying bezier:[self ...
1
vote
3answers
4k views

How do I save data to the iPhone properly and securely?

I'm creating a game using Cocos2D (objective-c) and it has come to the point where I have to save data to local storage, like high scores and similar stuff. I know that NSUserDefaults is not a good ...
2
votes
3answers
636 views

How do you maintain content size vs. content quality in a mobile application?

I am developing my first Cocos2d iPhone/iPad game that includes quite a few sprites, I would need approximately 80 different. As this is for both normal and HD displays I have 2x of each sprite. I am ...
1
vote
1answer
336 views

Objective - Gestures while finger touches screen

I'm creating a space cocos2d game with objetive-c. I have in the bottom left 2 arrows to move the sprite left or right. I also implemented a swipe gesture to change weapon, however it only happens ...
2
votes
1answer
2k views

Any way to set up a grid for a board game in cocos 2d?

My first idea was to create a 2d array for my columns and rows, but it seems like there should be a better, or possibly cleaner, way to achieve this. Each square on the grid is going to have a ...
1
vote
2answers
939 views

Cocos2d: Adding a CCSequence to a CCArray

I have a problem with an action performed by a sprite. I have one CCSequence in a CCArray and I have an scheduled method (is called every 5 seconds) that make the sprite run the action. The action is ...
2
votes
2answers
1k views

How to display image in second layer in Cocos2d

I am very new at Cocos2d and is testing to displaying an image over the "Hello World" text on a second layer and need help to get it work. I guess it is some basic stuff here and appreciate any tips ...
3
votes
3answers
2k views

Jumping a sprite while moving in a Bezier action

I'm creating a game and I need the sprite to jump (move up and down basically) while it's moving on a bezier path so it moves vertically while it still follows the path. If I do this while it's moving ...
2
votes
2answers
724 views

Registering collision on particles

I am using CCParticleSystemQuad to create particle effects. But I want my sprites to be able to collide with particles. Say your character is a dragon, the dragon breath is a particle effect emitting ...
3
votes
1answer
1k views

Best Method to Create Side Scrolling Levels? - Cocos2D

I am looking to start my first side scroller project using Cocos2D, but I am curious. What is the preferred/best method of creating you levels? For large levels I see hand making it very laborious, is ...
2
votes
1answer
754 views

How to use Kobold2D/Cocos2D to create a turn-based iOS 5 Game Center game?

I've searched for information on this, but cannot find it, is this not something you can do yet with Kobold2D/Cocos2D? or are there options I've missed?
1
vote
1answer
2k views

Cocos2D - How to move sprite on the X axis, using the accelerometer

I'm trying to make a vertical shooter, using Cocos2D and a few tutorials. Unfortunately, most tutorials only show how to make an horizontal shooter. Still, I tried to adapt the code from a horizontal ...
1
vote
4answers
2k views

Include Box2D libraries to a cocos2d project (iOS)

I have a problem including box2D to my cocos2d project. I've tried different ways to do it with no success. This is what I've done: I downloaded Box2D (Box2D_v2.2.1) to my project directory. Dragged ...
5
votes
1answer
2k views

(Why) Should I choose Unity 3 or Cocos2d (or something third) for my app? [closed]

My colleague and me made an HTML 5 iPad game ( http://braille.gandzo.com/ ) and we would like to upgrade it, and our framweork is not enoguh, for what we want. Some of the things we would change are: ...
0
votes
1answer
1k views

b2Body moves without stopping

I got a quite strange bug. It is difficult to explain it in two words, but i'll try to do this in short. My b2Body has restitution, friction, density, mass and collision group. I'm controlling my ...
2
votes
1answer
1k views

Making filled circles in cocos2d

How can you make filled-in circles in cocos2d? I understand you have to create a new method, but I don't really understand how it works/how to do it. Could someone please provide maybe an example or ...
2
votes
2answers
765 views

Efficient Bullet Firing Class

I've been struggling with this for a while. I have been trying to create a bullet pool class for a game I have made that doesn't cause a significant fps drop. I have tried creating a bullet pool ...
2
votes
1answer
529 views

How can I stop the next screen from briefly displaying at the start of a CCTransitionFadeTR?

I am testing transitions in cocos2d, and am running into a problem. I have a MainMenu screen which contains a button. The idea is that clicking on the button will trigger a CCTransitionFadeTR ...
0
votes
1answer
425 views

BOX2D Kinematic Platform with parallax layer

I am using a kinematic body for my moving platform on x-axis, so I set the linear velocity to b2vec2(5,0). When the player jump on the platform, it works like it is suppose to. But the thing is ...
3
votes
1answer
371 views

Cocos2d — Check if place is free before moving (all objects)

Is there a method in Cocos2d like CGRectIntersectsRect, except instead of limiting it to one sprite, it checks for ALL objects?
1
vote
1answer
1k views

Making an object swing from one rope to another

I am trying to make a Tarzan like game with Cocos2D and Box2D. I am having issues with the physics - making an object swing from one rope to another. I am not really sure how to do this. Could anyone ...
1
vote
1answer
771 views

Using tilemaps for an isometric football game with cocos2dx

I am writing a simple soccer game in cocos2d-x and recently found out that older iOS versions do not support cocos2d sprites larger than 1024x1024px. I was thinking about using isometric tilemaps to ...
4
votes
1answer
845 views

Cocos2D-iPhone, how does the Game Loop work in Cocos2D?

Could anyone theoretically explain how the game loop works in Cocos2D and Objective-C? If you need me to be more specific about what I'm asking, please read on. I've got a rudimentary understanding ...
-2
votes
1answer
2k views

To move the object (sprite) in all direction with constant speed in touch direction and to follow the touch path

I am developing this game in cocos2d. I want to move a object(airplane) in all direction with constant speed and it should move and flip in the direction of touch point and it should follow path make ...
3
votes
1answer
1k views

Cocos2d animation problem, [__NSCFString rect]: unrecognized selector sent to instance

I am testing (and learning) animation in Cocos2d using a series of .png's called "splash-x.png". I am getting error and at the first sight i thought it was easy to solve but it turned out that i ...
1
vote
2answers
575 views

Cocos2D: TileMap performance question

I´ve got a question regarding TileMaps. Each level in my game is going to be determined by the length of the tile map. I would like to create a map that will be about 5 mins (in length) long. I want ...
3
votes
4answers
10k views

What are the pros and cons of GameSalad versus Cocos2D?

I am currently using the Cocos2D framework for creating my game but I just happened to come across GameSalad and was amazed by this video. GameSalad claims to allow you to create games without ...
1
vote
1answer
492 views

Cocos2D Accelerometer Z axis

I am making a 2D scroller game where the player controls an airplane via the accelerometer I would like to know if it is possible to scale in and to scale out the sprite/airplane using the ...
7
votes
2answers
3k views

How to differentiate a tap from a drag

I'm creating an app and I'm trying to make it so I can drag a sprite (with a second sprite on top) around the screen, but if I just tap the sprite some other method should get called. I got the ...
3
votes
1answer
421 views

How do you incorporate cocos2d with regular iPhone UI widgets?

I want to build a sprite based game using cocos2d. I will be mostly drawing everything in code. I also want to incorporate iPhone UI widgets such as buttons and such. Can these be created to appear on ...
0
votes
1answer
424 views

Where does touch control logic go?

I'm creating a game (or app, depending on how you would define it...) where I'm moving objects (with sprites) on the screen. I've got this to half-work in both scenarios, but I can't seem to get it ...
0
votes
1answer
171 views

Cocos2 code structure question

I am doing tutorials to learn Cocos2d and have a question. here is the .m code: #import "SceneManager.h" @interface SceneManager () +(void) go: (CCLayer *) layer; +(CCScene *) wrap: (CCLayer ...
1
vote
1answer
3k views

Cocos2d CCSpriteFrameCache: couldn't load texture file

I am currently doing this Cocos2d tutorial: http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d ...and get the following error messages: 2011-12-30 16:36:28.536 ...
2
votes
1answer
8k views

cocos3d versus Unity for simple IOS 3D games?

Wondering if anyone here happens to have experience in doing some simple 3D based games/apps for IOS, using cocos3d & Unity and could give some pointers....questions I have are: GENERAL 1) It ...
2
votes
2answers
2k views

Cocos2d Composition using CCSpriteBatchNode

I'm making a game in objective-c using cocos2d. I have the following: @interface Player : CCNode { CCSprite *mySprite; CCSpriteBatchNode *sceneSpriteBatchNode; //... } @property ...
1
vote
1answer
624 views

How can I scroll sprites when swiping using Cocos2D?

I'm adding 3 sprites (layers) to CCParallaxNode: BGLayer = [CCSprite spriteWithFile:@"Layer.png"]; [_backgroundNode addChild:BGLayer z:2 parallaxRatio:layer1Speed ...
1
vote
3answers
2k views

Making smooth walk/jump/fly etc animations

i am soon gonna start with developing my own game for the iOS, i have the plan and idea of the game ready. BUT i have 1 question. How do people make such a smooth animation? Lets take for example: ...
2
votes
2answers
586 views

Z-order for cocos2d top-down game with sprite batching

I'm trying to understand how to create z-order system like you can see in http://www.realmofthemadgod.com/ Character is above the tree when he is in front of it and vice versa. Also, I'm planning to ...
1
vote
1answer
364 views

How can I create a curved line composed of images?

I have 50 little images. All are connected each other, as in a line, sort of like a cord. I want to move one of the node images and have the rest follow along like a cord, so they become a curve.