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

Weird error when enabling guard malloc

So I try to debug an EXC_BAD_ACCESS error by editing my scheme, enabling all the different checks. But the damn compiler gives me this error: dyld: could not load inserted library '/usr/lib/libgmalloc.dylib' because image not found I've googled…
marsrover
  • 715
  • 11
  • 27
9
votes
3 answers

Detect transparent part on the sprite in cocos2d?

I'm beginner in Cocos2d. I have a sprite, and I want to ignore touch on transparent area of that sprite. I'm aware of this answer Cocos2d 2.0 - Ignoring touches to transparent areas of layers/sprites, and also this great article…
User1234
  • 2,362
  • 4
  • 27
  • 57
9
votes
2 answers

What are the "gotchas" when developing an iPhone Game?

Am used to developing business and reference apps. Now I have to do an iPhone game. What tips can you share to help me with: understanding the scope of the project defining the deliverables specifying the game play and other parameters estimating…
9
votes
4 answers

Multi-threaded OpenGL Programming in Cocos2D-iPhone

In an attempt to create a loading bar for an iPhone game I'm developing (using Cocos2D), I wanted to use a multithreaded approach. One thread shows a loading screen and runs the main application event loop while a new thread silently loads all the…
Asad R.
  • 1,051
  • 13
  • 20
9
votes
2 answers

Objective-C Category and new iVar

I try to extend the functionality of SimpleAudioEngine of cocos2d with the ability to play several sound effect one after another as some kind of chain. I tried to do this with an extension. However I now realized that I probably also need an iVar…
gebirgsbärbel
  • 2,327
  • 1
  • 22
  • 38
8
votes
2 answers

How to link to coco2d static library (1.1 beta 2) using workspaces in Xcode 4.3.1

I have done the following so far: Created workspace Added my project Added the Cocos2d iOS project (by dragging dropping into project navigator). It is a sibling of my project (not child). In my project, in build phase, linked to libcocos2d.a In…
Rahul Iyer
  • 19,924
  • 21
  • 96
  • 190
8
votes
3 answers

cocos2d getting a sprite to blink, it becomes invisible

im trying to make my sprite blink, but it just disappears, i have searched google, but i cant find a solution, heres what im doing: CCBlink * blinker = [CCBlink actionWithDuration: 0.5 blinks: 1]; [player runAction: blinker]; this method is…
sahil
  • 141
  • 1
  • 9
8
votes
1 answer

How to rotate coordinate system?

I am trying to find the new value of a coordinate if I rotate around the origin. For example, say I have the point (1,1). If I rotate the coordinate axis 45 degrees around the origin, the transformed coordinate would be (0,1.414) Is there a way to…
xcoder
  • 967
  • 2
  • 11
  • 24
8
votes
3 answers

random BOOLs in an efficient way for cocos2d

According to Steffen's post this is an efficient way to generate random BOOLs in cocos2d +(BOOL) getYesOrNo { return (CCRANDOM_0_1() < 0.5f); } but how do I set a range for this? (e.g. 0 - 29 is the interval and 5 ones BOOL = NO, 25 ones BOOL =…
el.severo
  • 2,202
  • 6
  • 31
  • 62
8
votes
2 answers

Polygon triangulation into triangle strips for OpenGL ES

I am looking for a fast polygon triangulation algorithm that can triangulate not very complex 2D concave polygons (without holes) into triangle strips ready to be sent to OpenGL ES for drawing using GL_TRIANGLE_STRIP. I am aware of some algorithms…
8
votes
4 answers

Collection <__NSArrayM: 0x76c11b0> was mutated while being enumerated

I'm relatively new to obj-c, so I must be missing something, but my program crash when an enemy collides with a wall. I've located where I'm removing the enemy from the loop, while in the loop, but for the life of me, i can't figure out how to fix…
user1091516
  • 93
  • 1
  • 1
  • 7
8
votes
1 answer

Xcode: Cocos2d: Can't create world with Box2D

My project originated as the cocos2d Box2D template and I'm having issues as soon as I tried to create a world: world = new b2World(gravity,doSleep); Gives the error: No matching constructor for initialization of 'b2World'. The file is .mm, I…
FBryant87
  • 4,273
  • 2
  • 44
  • 72
8
votes
2 answers

OpenGL, primitives with opacity without visible overlap

I'm trying to draw semi-transparent primitives (lines, circles) in OpenGL ES using Cocos2d but can't avoid the visible overlap regions. Does anyone know how to solve this?
erik
  • 448
  • 5
  • 10
8
votes
1 answer

Using the same action on multiple sprites?

I want to create an action once, then add it to multiple sprites. For example, I have a 'monster' that gets a bunch of legs added to its body. Each of these legs are children of the body, and I want them to rotate back and forth. I made a…
Steve
  • 6,332
  • 11
  • 41
  • 53
8
votes
4 answers

Cocos2d schedule only once

How can I make cocos2d schedule selector only once? Right now the best I can do is: [self schedule:@selector(eventHappend:) interval:2]; and eventHappend: - (void)eventHappend: (ccTime) dt { [self unschedule:@selector(eventHappend:)]; // Do…
Daniel
  • 30,896
  • 18
  • 85
  • 139