Questions tagged [cocos2d-iphone]

Objective-C version for iOS & OS X of Cocos2d. Cocos2d is a framework for building 2D games and graphical applications.

Cocos2D for iPhone is an framework for building 2D games and graphical applications for iOS devices and Mac OS X computers. Cocos2D for iPhone was ported from the Cocos2D Python-based framework.

"Cocos2D for iPhone" (project name: cocos2d-iphone) is a free and open source project published under an MIT License.

"Cocos2D" (project name: cocos2d) is the "grandfather" of all Cocos2D game engines. Cocos2D is written in Python and allows developers to create games and applications for Windows, Linux and Mac OS X. Cocos2D is published under a BSD License.

There are a number of other Cocos2D based game engines, the most actively updated and most widely used are:

ShinyCocos (Ruby), CocosNet (C#) and Cocos2D for Windows (C++) haven't been updated in a long time, these Cocos2D versions are considered defunct. Cocos3D is a 3D extension to Cocos2D. See the Cocos2D Game Engines list for a complete overview.

The immense popularity of Cocos2D for iPhone has the effect that most developers use the term "Cocos2D" when referring to the Cocos2D for iPhone framework.

It is recommended to use the following tags appropriately:

  • Use the tag on questions referring to the Python based framework
  • Use the tag on questions referring to the Objective-C based framework
  • Use the tag on questions referring to the C++ based cross-platform framework
  • Use the tag on questions referring to the JavaScript based framework
  • Use the tag on questions referring to the C#-MonoGame Framework.
  • Use the tag on questions referring to the Java based frameworks
  • Don't use any of the above tags together in the same question, unless your question refers to more than one Cocos2D engine. For example, if you ask "How to port from cocos2d-iphone to cocos2d-x?" you should include both and tags.

Books:

10198 questions
12
votes
2 answers

Multitouch not working in cocos2D for iPhone

I am quite familiar with cocos2D (been working with it for over 1 year) and I encountered a problem with my multitouch game - the multitouch. What I have: [glView setMultipleTouchEnabled:YES] in my delegate. A playscene that does NOT implement…
George
  • 4,029
  • 1
  • 23
  • 31
12
votes
1 answer

Cocos2d - a way to get the current scene?

I'm looking for a way to get the current scene so that I'll be able to tell which scene is running at any time. Thanks!
jkigel
  • 1,592
  • 6
  • 28
  • 49
12
votes
7 answers

How to hide FPS numbers in bottom left of screen in Cocos2d

How do I get rid of the numbers in the bottom left of the screen when I am making a cocos2d game? This is probably a newb question, but still.
skippy_winks
  • 778
  • 3
  • 14
  • 31
12
votes
7 answers

Problem with cocos2D for iPhone and touch detection

I just don't get it. I use cocos2d for development of a small game on the iPhone/Pod. The framework is just great, but I fail at touch detection. I read that you just need to overwrite the proper functions (e.g. "touchesBegan" ) in the…
maw
12
votes
6 answers

What mathematics is needed for a lunar lander game?

I'd like to build a game to learn cocos2d. Lunar lander is the first exercise coming in my mind. Any pointer/source code/tutorial of the physics calculations required will be appreciated. Thanks!
ohho
  • 50,879
  • 75
  • 256
  • 383
12
votes
1 answer

Change the background image in cocos2d

I am making a game using cocos2d. in that I want to change the background after each second of time. I don't know how to do this in cocos2d. I am having 15 different images and one by one each image will be shown, i.e. after1 second next image will…
V.V
  • 3,082
  • 7
  • 49
  • 83
12
votes
3 answers

differences between NSArray and CCArray

What are the differences between NSArray and CCArray? Also, in what cases will one be preferred to the other with respect to game programming?
oopology
  • 1,072
  • 1
  • 10
  • 19
12
votes
1 answer

iOS 6 - How to run custom code when orientation changes

I'm creating a game that allows the device to be in either landscape-left or landscape-right orientation, and the player can change the orientation while it's paused. When they do I need to change the way the game interprets the accelerometer based…
James
  • 736
  • 1
  • 5
  • 19
12
votes
2 answers

Adding Multiple UITapGestureRecognizers to single view (Cocos2d)

I am adding the following code in the onEnter method. doubleTapRecognizer_ = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)]; doubleTapRecognizer_.numberOfTapsRequired = 2; …
Joshua Goossen
  • 1,714
  • 1
  • 17
  • 36
12
votes
7 answers

Cocos2d v2.x, failing to install templates.. permission denied. Am I doing something stupid?

I would like to clarify this issue. I had installed Cocos2d 1.01 rc on my iMac, with XCode 4.3 installed, and I have now dowloaded v2.0 and wanted to install the templates (following the official guide). Unfortunately the terminal gives me…
mm24
  • 9,280
  • 12
  • 75
  • 170
12
votes
3 answers

How to uninstall cocos2d templates?

Situation: - Just few hours ago I intalled cocos2d 2.x - But just before it I delete template files of cocos2d 1.0.1 - Now I can't see template files of cocos2d 2.x - In Xcode both of the templates are visible, and I can use them.…
Anatoliy Gatt
  • 2,501
  • 3
  • 26
  • 42
11
votes
2 answers

Mixing C++ and Objective-C

I am using C++ as the app backbone and Objective-C for the GUI, that's fine. But when it comes to mixing those code together in Objective-C++ (.mm file), I have got a few question: 1. Can I mix STL containers with Objective-C or Cocos2D…
RoundPi
  • 5,819
  • 7
  • 49
  • 75
11
votes
1 answer

Moving a Stick figure, anchorpoints, animation, or something else...?

Ok so I am making a game with stick figures with cocos2d in objective c... Different things need to be animated so please, give me a suggestion of what would be the best way to go about accomplishing the movement for these things: The main…
Gabriel
  • 3,039
  • 6
  • 34
  • 44
11
votes
1 answer

How to stop the forces acting on a body in box2d

I am using box2d on the iphone to create a game. I have a body that is effected by gravity to move down and not right or left. It will get hit by another body and will then be moving right or left. I then have a reset button which moves the body…
user891123
  • 379
  • 2
  • 5
  • 16
11
votes
5 answers

How to popScene with transitions in cocos2d?

When i call relpaceScene or pushScene in cocos2d, I can add some transitions to it like: [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1 scene:scene]]; but when i call popScene, it takes no parameters, and no…
willzeng
  • 169
  • 1
  • 5