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
11
votes
7 answers

How can I detect touch in cocos2d?

I am developing a 2d game for iPhone by using cocos2d. I use many small sprite (image) in my game. I want to touch two similar types of sprite(image) and then both sprite(image) will be hidden. How can I detect touch in a specific sprite(image) ?
Md Nasir Uddin
  • 2,130
  • 8
  • 38
  • 59
11
votes
1 answer

sound pitch pan gain?

In cocos2d, I came across a tutorial: [[SimpleAudioEngine sharedEngine] playEffect:@"gunfire.mp3" pitch:0.5f pan:0.5f gain:0.5f ]; I'm not sure I understand the difference between these properties.
stone
  • 841
  • 3
  • 16
  • 26
11
votes
3 answers

Best practices for handling touches to a CCSprite with cocos2d

Hey all. I just started looking into the cocos2d library. I've heard that it's an easy library to get into if you're used to programming in ActionScript and I've found that a lot of the concepts are indeed similar. I started looking through sample…
donkim
  • 13,119
  • 3
  • 42
  • 47
11
votes
2 answers

How to disable iPhone 6 native resolution?

I have several games made with Cocos2d-iphone. All of them are old projects created with Xcode 4 or 5. All games scale fine on the new iPhone 6 and 6 Plus except one that seems to avoid the scaling mode and is running on native iPhone 6/6 Plus…
Dunbar
  • 401
  • 5
  • 9
11
votes
3 answers

error when creating an archive of my cocos2d app

I'm using cocos2d-iphone (develop-v2) and xcode 5 and have this error when trying to archive my app: (and not when I compile it) libs/kazmath/src/neon_matrix_impl.c:64:15: error: unknown register name 'q0' in asm : "memory", "q0", "q1",…
franck
  • 2,995
  • 3
  • 17
  • 28
11
votes
1 answer

changing box2d body shapes dynamically

Is it possible to change the shape of a Box2d b2Body dynamically? I want to do this to achieve the following. i). Increasing the radius of a circle shape at a certain rate ii). Changing the dimensions of a bounding box for a sprite to match the…
oopology
  • 1,072
  • 1
  • 10
  • 19
11
votes
1 answer

How can I add a font to my Cocos2D iOS project and use it with a CCLabelTTF?

I need to use a custom font with my Cocos2D project. I've tried a few techniques, but Cocos2D keeps reporting: Unable to load font XXX.ttf Why can't I get my custom font to work with with Cocos2D? ADDITIONAL INFORMATION This is a…
RLH
  • 15,230
  • 22
  • 98
  • 182
11
votes
3 answers

Directional Lights

I'm working on a game idea (2D) that needs directional lights. Basically I want to add light sources that can be moved and the light rays interact with the other bodies on the scene. What I'm doing right now is some test where using sensors (box2d)…
Sebastián Castro
  • 1,408
  • 10
  • 28
11
votes
2 answers

How can I display the bounding box for a CCNode in cocos2d?

As a follow-on question to my previous question about displaying the anchor point, I subclassed CCSprite and changed its draw method as follows: [super draw]; ccDrawColor4F(0, 1, 0, 1); ccDrawCircle(self.anchorPointInPoints, 20, 0, 8, YES); This…
Dylan
  • 2,315
  • 2
  • 20
  • 33
11
votes
4 answers

How to know when an user rates an iOS app/game

I am developing a game for iOS. I would like to implement a feature that allow the user rate my app and, if he does it, he will get points for my game. I know how to display an screen, menu, whatever to ask the user rate my app, but I don't know…
Juanjo
  • 929
  • 1
  • 15
  • 29
11
votes
2 answers

Cocos2d 2.0 Adding UIView to CClayer openglview deprecated

I'm having some troubles adding an UIView to cocos2d v2.0 since the openGlView is deprecated I can't add the view to it. I was looking around to find another way to do this but I couldn't find anything. Can anyone tell me the new way to add an…
Rafael Jimeno
  • 626
  • 2
  • 8
  • 20
10
votes
2 answers

"BackgroundMoving" Code is not Working in iPhone4S

I am making one game in which i am facing problem when I test my App on Device(iPhone4) the background of it is not working. Like when background image ends BLACKISH BACKGROUND COLOR comes. My Background image size is 460X2880,image name…
NSExpression
  • 721
  • 5
  • 18
10
votes
4 answers

How can I determine which objects hold references to other objects that are causing memory leaks in objective-c?

I have tried using the leaks tool, and "analyze" etc to find the leak, but it can't find it. Using allocations I can determine the objects which are not being released. I have noticed (by adding debugging statements in the dealloc method), that…
xcoder
  • 967
  • 2
  • 11
  • 24
10
votes
2 answers

Simultaneous CCActions Cocos2d

Is it possible to run multiple ccactions on a sprite at the same time? For example, if I have a CCFadeIn, a CCScaleTo, and a CCRotateBy, all with the same duration, can I run all three on a sprite at the same time? The only thing I have found that…
eric.mitchell
  • 8,817
  • 12
  • 54
  • 92
10
votes
2 answers

Why does xcode archive succeed but create an empty .xcarchive file?

Background I have an application I'm trying to archive and submit to the app store for approval. Part of the process requires the archive to be prepared and loaded using application loader. I used product-> archive and it prompts archive succeeded…
Azeworai
  • 772
  • 3
  • 9
  • 25