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

12
votes
5answers
1k views

tunnel effect cocos2d

I am looking to create a similar tunnel effect in COCOS2D (iOS). Could anyone suggest any pointers? ref Video 1 ref Video 2 Till now I have tried with several ring shape sprites with decreasing ...
10
votes
7answers
2k views

Seperation of drawing and logic in games

I'm a developer that's just now starting to mess around with game development. I'm a .Net guy, so I've messed with XNA and am now playing around with Cocos2d for the iPhone. My question really is more ...
9
votes
2answers
542 views

How do I simulate a swinging pendulum?

I want to simulate a rope with a weight attached, swinging back and forth like a pendulum. Any actual physics is overkill; it's just endlessly repeating the same motion. JQuery has a the "swing" ease ...
9
votes
1answer
9k views

Blend Modes in Cocos2D with glBlendFunc

We've been trying to replicate the most common blending modes that are available in Photoshop and Quartz 2D, but we've only come up with 3 and that's after some long searching online. For anyone ...
8
votes
2answers
2k views

How to create 2D game terrain?

Last month, I experimented a lot in game development using cocos2d for the iPhone, especially on moving and modifying sprites. However, vertices and polygons are still new stuff for me. I developed ...
8
votes
1answer
3k views

Basic Box2D collision detection

I don't understand how to listen for collisions in Cocos2D/Box2D. Say I have two dynamic circle bodies. One is very small and the other is relatively large. When the small circle collides w/ the ...
8
votes
2answers
673 views

Where do I store strings? What's an efficient way of loading them?

I'm making a top-down RPG for iPhone. I'm using tilemaps (CCTMXTileMap) and the cocos2d-iphone engine. I've made a class that can handle loading maps and NPCs onto the screen, a class that handles ...
8
votes
3answers
8k views

Comparison between Cocos2d and Corona [closed]

I'm having a really hard time deciding which way to go on this. I'm about to start developing a game and I haven't been able to find many good comparisons between these approaches. I don't have many ...
8
votes
2answers
1k views

What's the recommended bitrate for Background Music in iPhone Games?

What is the recommended bitrate for Background Music in iPhone Games?
8
votes
1answer
671 views

How are you handling scores that can worsen (e.g. Elo rating) in Game Center?

Currently, Game Center leaderboard scores can only change one-way (e.g. increase). This makes it impossible (I think) to deal with Elo ratings and the like. How are you getting around this in your ...
7
votes
2answers
2k views

How to create an endless scrolling background?

I need to add a scrolling background to a my game, the image is 512x512px. It's for a car game with two way traffic and I want to be able to cross over to the opposite side and drive against 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 ...
6
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 ...
6
votes
1answer
508 views

OpenGL ES object rotation around z axis

I have an object on my screen which is presented rotated and panned, But i have 2 problems regarding the z axis rotations. It's a bit tricky to explain so i uploaded 2 videos to describe each problem. ...
5
votes
2answers
2k views

How to make Snake Body in Snake Game?

I'm new in cocos2d and game dev. I'm still learning in game dev. My goal is to make one game like Doodle Grub. But problem is snake body. I wrote like following -(void)update:(ccTime)delta { ...
5
votes
4answers
1k views

How to port a game from IPad to Iphone [closed]

I just finished developing a 2D side scroll game for the IPad using Cocos2d and Box2d. Now we want to make an IPhone 4 version of the game, but I'm still not sure what is the best way to do it. I ...
5
votes
2answers
1k views

cocos2d Merging box2d bodies

i'm using cocos2d to build an iphone game. my game currently has two sprites: one for the main character and another for an item i should carry once he gets on him. the main character and the item ...
5
votes
2answers
2k views

How to make bird to fly using box2d

I am new to Box2D, I have set gravity to 10. How to make an object fly in space even though the gravity is 10. What are the properties I need to set to make object fly? Is there any different ...
5
votes
1answer
227 views

How can I implement a “Nyan Cat” rainbow?

I'm currently making a game similar to this Nyan Cat flash game, although I'm using cocos2d. I'm having a hard time trying to make the rainbow effect: Currently, every update call I add a piece of ...
5
votes
3answers
5k views

Tracking Multiple Touches using Hash codes in Cocos2d for iPhone

How do you implement a touch hash code and reference it later? I have read about a "hash" code, but I don't understand how to use it. I want to know when two of my Sprites are touched at the same ...
5
votes
1answer
482 views

Do I need to roll my own polygon segmentation algorithm to automate Box2d body creation from a tile map?

Before re-inventing the wheel I figured I'd ask: I'm working on a tile-based 2d-maze level generator for cocos2d + box2d. The idea is: I'm using one of the well-known graph traversal algorithms to ...
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: ...
5
votes
2answers
3k views

How to make animated buttons in a menu with Cocos2d?

How do I make animated menus with cocos2d, I just want to animate the buttons and not the entire scene. Effects I look for is flipping buttons (like the back of the button is the next menu), buttons ...
4
votes
2answers
1k views

Presenting game center leaderboard

I have the following code: -(void)showLeaderboard { GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init]; if (leaderboardController != NULL) { ...
4
votes
3answers
644 views

Determine animation frame from interval

I have an array of sprites that are displayed in-order to make an animation. There is code in an update loop that has access to a value 'time' indicating how far along the animation is. Time is a ...
4
votes
1answer
673 views

Typical Method Of Building Puzzle Levels

I am designing a puzzle game for the iphone and was wondering as most puzzle games consist of the player progressing through multiple levels. You see for example Angry Birds has over 100 levels. Once ...
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 ...
4
votes
1answer
831 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 ...
4
votes
1answer
540 views

Collision Filtering in Box2D

I have four bodies in my Box2D World. Each are polygon shape, with some physics parameters. Now when the game start, I need one of the bodies from the World (BodyA) to not be allowed to collide with ...
4
votes
1answer
108 views

Is it better to preserve scenes in memory or recreate them every time I need them?

I am using Cocos Builder to create scenes using sceneWithNodeGraphFromFile:owner:. Now I have doubts about whether it's better, on iOS, to save some memory or CPU cycles. In other words I have two ...
4
votes
1answer
4k views

How to create endless scrolling landscape using coco2d's CCParallaxNode

I created a horizontally scrolling landscape using CCParallaxNode. However it does not seem to support endless scrolling in one direction. As soon as the first image "ends" the background shines ...
4
votes
1answer
510 views

Worth using Box2d for collision but not physics?

I am currently doing some work in cocos2d-x and am thinking about using their box2d implementation for things like collision detection (but not necessarily response), range detection, and other things ...
4
votes
0answers
5k views

tool to create a motion path for cocos2d [closed]

I want to move a ccsprite object along a pre defined path. ( Similar to motion guide in flash) Is there any tool i can use to create this path?
3
votes
3answers
345 views

What is actually loaded during a game's loading screen?

I am at the stage of my game where I have to develop the loading screen. It's actually already there, but I don't know exactly what it should be loading while it's presented. Why would I have a ...
3
votes
3answers
3k views

Getting isometric grid coordinates from standard X,Y coordinates

I'm currently trying to add sprites to an isometric Tiled TMX map using Objects in cocos2d. The problem is the X and Y metadata from TMX object are in standard 2d format (pixels x, pixels y), instead ...
3
votes
4answers
571 views

Who controls my player's movement?

In my game, does my player object control the movement, or does the map object control it? (Or some other object?) The player doesn't know about the map's contents to stop at solids, interact with ...
3
votes
4answers
1k views

iPhone Game framework on top of cocos2d?

I am using cocos2d to develop iPhone game, however, it is just an 2D engine and developer is too flexible to use them - i.e. codes tends to be unmanageable. Are there any more high level framework ...
3
votes
4answers
9k 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 ...
3
votes
2answers
518 views

How to deal with procedural terrain, pre-load or real-time calculation?

I have developed an algorithm that generates 2D terrain coordinates for my iOS 2D game. This may be a possible visual output: The coordinates are stored in a 2D array. mVertices[i][0] = ccp(sx, ...
3
votes
1answer
414 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 ...
3
votes
1answer
427 views

Smoothing rotation

I've spent the last three days trying to work out how to rotate a sprite smoothly depending on the velocity.x value of the sprite. I'm using this: float Proportion = 9.5; float maxDiff = 200; float ...
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 ...
3
votes
1answer
939 views

create a simple tilemap programatically

i am working on a tile roguelike i got some of the basics working using this tutorial http://www.raywenderlich.com/1163/how-to-make-a-tile-based-game-with-cocos2d but i want to be able to create a ...
3
votes
2answers
1k views

When and how should I apply forces in a Cocos2D + Box2D game?

I have some small circles just rolling across the bottom of the screen in my Cocos2D/Box2D iOS app. The bodies are dynamic... so I make them roll by applying a horizontal force to the center of mass ...
3
votes
1answer
4k views

iPhone image asset recommended resolution/dpi/format

I'm learning iPhone development and a friend will be doing the graphics/animation. I'll be using cocos2d most likely (if that matters). My friend wants to get started on the graphics, and I don't ...
3
votes
4answers
339 views

What is technical specs for iOS platform for a game?

I would like to know when a contractor ask you for a technical specs for iOS platform of a game, what's the description that you should give back to him?
3
votes
2answers
827 views

2D Animation Smoothness - Delta time vs. Kinematics

I'm animating a sprite in 2D with key frames of rotation and xy-positions. I've recently had a discussion with someone saying that when the device (happens to be an iPad using cocos2D) hits a ...
3
votes
1answer
357 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?
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 ...
3
votes
1answer
2k views

How to extend Tiled and Cocos2d to create an Isometric map that supports elevation

I've been looking and looking and looking, and I cannot seem to find a solution out there for making a game that uses cocos2d and Tiled to make an isometric map that supports elevation. I am not ...