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
9
votes
3 answers

Adding Cocos2D only to already existing project?

I already have a project that is 90% done and I want to add Cocos2D ONLY to it. I do not need Box2D or Chipmunk. How would I do this? What files do I add? I really need this done, so in the end ill offer a bounty if needed. Thanks!
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
9
votes
2 answers

CADisplayLink target selector being triggered after it is invalidated

I have a CADisplayLink that triggers a draw method in a Director object. I want to invalidate the CADisplayLink and then deallocate some singleton Cache objects that are used by the Director object. The singleton Cache objects are not retained by…
Ricardo Sanchez-Saez
  • 9,466
  • 8
  • 53
  • 92
9
votes
4 answers

Cocos2D Rotation and Anchor point

The problem that I have is that when ever I change the anchor point sprite automatically rotates with respect to the current anchor point. And I don't want that to happen. The steps that I followed create a sprite with anchor point (0.5,…
Jose Antony
  • 103
  • 1
  • 7
9
votes
7 answers

How do i simply change a sprite's image in cocos2d?

I've tried [[CCTextureCache sharedTextureCache] addImage: @"still.png"]; But I always end up with a distorted image for some reason. It's most likely because my images are not the same resolution, but for this app, they can't have the same res. How…
user663425
  • 275
  • 1
  • 5
  • 11
9
votes
2 answers

cocos2d-iOS - Gesture recognisers

Has anyone managed to get the gesture recognition working in cocos-2d? I have read a post here that claimed to have achieved it, here: http://www.cocos2d-iphone.org/forum/topic/8929 I patched from the git hub here:…
Robert
  • 37,670
  • 37
  • 171
  • 213
9
votes
2 answers

Best way to display a game score on iPhone with cocos2d?

I am looking to persistently display a game score in an iPhone app using cocos2d. Going off the code that cocos2d shows the FPS the app is running at: -(void) showFPS { frames++; accumDt += dt; if ( accumDt > 0.1) { frameRate…
user21293
  • 6,439
  • 11
  • 44
  • 57
9
votes
5 answers

Cocos2d: Solid color rectangular sprite?

I must be missing something! I want to create a solid rectangular CCSprite with a background color initialized to a particular RGB value. I have looked all over the docs and can't find anything. Is there a way to initialize the background of…
poundev23
  • 807
  • 3
  • 11
  • 18
9
votes
1 answer

RunWebThread taking up 33% of CPU time on iPhone App

I'm making a game for the iPhone using Cocos2D. At the beginning of the game, when there are few sprites, the game runs fine, but when there are many sprites on the screen, the game gets choppy. I've profiled the app, and RunWebThread seems to be…
Jessica
  • 393
  • 3
  • 5
  • 13
9
votes
4 answers

Cocos2d Resources

Any recommendations on good sites/resources on programming with the Cocos2d-iPhone game engine? What worked for you? What is the canonical place for all things Cocos2d? Any sites you recommend? Best practices? Blogs? Much appreciated
Brian Liang
  • 7,734
  • 10
  • 57
  • 72
9
votes
7 answers

Android.mk - build all source file in a directory

I am using Android NDK to build my cocos2dx project, within the Android.mk, there is a definition for LOCAL_SRC_FILES where each of the cpp file are listed. Whenever I added a new source file, I'd need to add it there as well... it looks like…
Zennichimaro
  • 5,236
  • 6
  • 54
  • 78
9
votes
4 answers

Replacing image in sprite - cocos2d game development of iPhone

I want to change the sprite image. Say for example: mainSprite=[Sprite spriteWithFile:@"redFile.png"]; [self addChild:mainSprite]; Here, Sprite is already added to a layer. I have mainSprite (pointer) which can access it. If I change [mainSprite…
sagarkothari
  • 24,520
  • 50
  • 165
  • 235
9
votes
1 answer

How to detect when sound effect finish playing?

I'm using SimpleAudioEngine and I'm trying to detect if a sound effect is finish playing before continuing. I'm looking for any method, but the one I'm trying to implement doesn't work! CDSoundEngine *engine = [CDAudioManager…
9
votes
2 answers

How to scale transition UILabel without using a lot of memory?

I'm trying to reproduce some of the 2D transitions in Impress.js's sample presentation in Objective C. Specifically the rotate, pan, and scaling - right now I'm focusing on the scaling. I've tried scaling a UILabel to the point where it "passes the…
Luke
  • 13,678
  • 7
  • 45
  • 79
9
votes
1 answer

How to check whether there is internet connection with the device: cocos-2d

In one of my iPhone app, I need to find out whether there is internet connection with the device or not. Anyone pls help?
Krishna Raj Salim
  • 7,331
  • 5
  • 34
  • 66
9
votes
2 answers

why is only 60 fps really smooth in cocos2d?

It has probably been asked before, but I can't find it anywhere... In videoland, 24 fps and anything above is smooth. Cocos2d seems to be smooth only when its 60 fps or maybe a bit less. Anything between 30 and 50 is certainly not smooth, the fps…
yurki
  • 95
  • 1
  • 5