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
21
votes
2 answers

"Semantic error: Redefinition of '__ccContentScaleFactor' with a different type" in Cocos2D v2

i have developed a new game and it is running perfectly fine on my real ios devices and even on simulators but when i decided to submit it to AppStore it is giving error on this line. extern CGFloat __ccContentScaleFactor; and error is…
user2966615
  • 373
  • 4
  • 16
21
votes
3 answers

Cocos2d + Box2d or Chipmunk

OK, im trying to make an iphone version of a game i made here http://scratch.mit.edu/projects/techy/781198 is box2d or chipmunk better and where are some tutorials for each one
techy
  • 544
  • 2
  • 6
  • 20
21
votes
2 answers

What is the alternative method for the "self.isTouchEnabled " in Cocos2d 2.0?

When I use the self.isTouchEnabled = YES in Cocos2d v2.0 for the layer could be touched,the Xcode give me a tip: setIsTouchEnabled: is deprecated Now, I just want to know alternative method for isTouchEnabled.
Vienta
  • 213
  • 3
  • 6
21
votes
2 answers

Why should cocos2d-iphone users avoid using the @2x file extension?

Cocos2d-iphone uses the -hd extension for Retina images (and other assets). The cocos2d Retina guide speaks only vaguely of "some incompatibilities" regarding @2x: Apple uses the ”@2x” suffix, but cocos2d doesn't use that extension because of…
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
20
votes
4 answers

Applying Zoom Effect In cocos2D gaming environment?

I'm working on a game with cocos2D game engine and make load all the sprites while it load the level, now as because some of sprites (obstacles) are taller than 320 pixel, thus it seems difficult to check them out. So for the convenience sake I want…
rptwsthi
  • 10,094
  • 10
  • 68
  • 109
20
votes
6 answers

How can I create a count down timer for cocos2d?

I am developing a 2D iPhone game by using cocos2d. I need a countdown timer. How can I create a count down timer in cocos2d?
Md Nasir Uddin
  • 2,130
  • 8
  • 38
  • 59
20
votes
3 answers

Using custom fonts in Cocos2d

How do I use custom TTF fonts in my Cocos2d iPhone apps?
Hanaan Rosenthal
  • 1,359
  • 1
  • 11
  • 20
20
votes
3 answers

Objective C - get the following day from today (tomorrow)

How can I check to see if a date is inherently TOMORROW? I don't want to add hours or anything to a date like today, because if today is already 22:59, adding too much would go over to the day after, and adding too little if the time is 12:00 would…
waylonion
  • 6,866
  • 8
  • 51
  • 92
20
votes
8 answers

How can I disable the touch detection?

How can I disable the touch detection within the action that running, because I don't want the character flying in the sky like a superman if the player clicking and clicking within the action, the character will never land if they keep clicking. I…
Criz
19
votes
3 answers

How to draw a line with Cocos2d-iPhone

I'm trying to get to grips with Cocos2d by trying to accomplish simple things. At this point, I have a scene, that scene has a background sprite, and a Layer. I'm trying to draw onto the Layer using drawLine. Here's my current attempt.…
gargantuan
  • 8,888
  • 16
  • 67
  • 108
19
votes
1 answer

How do you supress OpenGL messages in Xcode for iOS 12.0

I'm using an old version of Cocos2d-iphone and need to come up with one last release before I completely reconfigure my app for Metal support. Until then, I'm trying to work through all the deprecated issues besides the OpenGL stuff. As it is, I…
PWiggin
  • 956
  • 2
  • 12
  • 24
19
votes
1 answer

Is it possible to achieve MAX(As,Ad) openGL blending?

I am working on a game where I want to create shadows under a series of sprites on a grid. The shadows are larger than the sprites themselves and the sprites are animated (i.e. move and rotate). I cannot simply render them into the sprite png, or…
Jeff B
  • 29,943
  • 7
  • 61
  • 90
18
votes
2 answers

Proper Swipe gesture recognizer iOS

I haven't been able to find a tutorial on how to properly setup a gesture recognizer for iOS. I need to detect swipe up & down, and the callbacks for them. Any help, appreciated. Thanks.
iamruskie
  • 766
  • 4
  • 9
  • 22
17
votes
1 answer

OpenAL randomly stops playing some sounds, can only fix with reboot

THE APPS: Two Cocos2d universal iOS games with a large customer base. THE PROBLEM: Several months back (in 2011) reports started coming in, sounds would randomly cut out, only some of the sounds would play in the app, others wouldn’t. This problem…
peter
  • 471
  • 5
  • 16
17
votes
1 answer

cocos2d: playing a video in the background of a menu

I have a a CCLayer with the start menu of my app and I would like to have a short movie playing in the background. I have succeded in playing a movie in the glView but when it plays the menu is not depicted. To handle the movie I instantiate a…
Andrea Sindico
  • 7,358
  • 6
  • 47
  • 84