cocos2d for iPhone is a free open-source framework for building 2D games, demos, and other graphical/interactive applications for iOS devices.

learn more… | top users | synonyms

0
votes
1answer
385 views

How to store level information on iOS

Let's imagine I have a breakout game. I make a level like this: For columns < max columns For rows < max rows Create sprite from file, put it on some position based on ...
1
vote
0answers
245 views

Getting contour without the background [closed]

I have a texture and vertex which are needed to create a set of closed polygons. For this purpose I use these functions: Code for create texture: CCSprite* spr = ...
1
vote
1answer
296 views

How do I identify a collision with a specific body?

How can I identify when the ground body collides with another b2Body? I can use b2ContactListener to be notified of collision events, but how do I tell which bodies collided?
-1
votes
2answers
413 views

Good open source iOS games? [closed]

I would like to see how things are done in modern iOS games, I am especially interested in Cocos2D games. I need a game that will compile (warnings are ok) and since most of the project I have seen ...
1
vote
1answer
213 views

Touch area double sized on newer device

I am developing a universal puzzle game, in which I have used separate image for iPhone4 and for iPhone3, iPhone4 image is double in size of iPhone3 image. My issue is for iPhone4, touch area of image ...
-2
votes
1answer
207 views

How to begin stylising a game [closed]

I'm currently in the late stages of development for a platform-esque iPhone game and am beginning to look into the graphics. Being a developer through-and-through, I have limited design skills and my ...
1
vote
1answer
120 views

Why is the MaskBit maxed out

Hi there for some reason the maskbit of my b2FixtureDef is being maxxed out and im not sure why Here is the declaration of the items that are used in the game enum PhysicBits { PB_NONE = 0x0000, ...
1
vote
3answers
2k views

Moving camera in large view

In my cocos2d app I was wondering how to make a CCSprite move on the screen but have the screen focused on the CCSprite, so when the sprite moves the view moves with the CCSprite. Is there a tutorial ...
-2
votes
1answer
1k views

Rolling a 3d die in cocos2d

How can I have a 6 sided die in my cocos2d game and when the device is shaked the die rolls and shows a number? I would also use UIKit if it was necessary.
0
votes
1answer
328 views

Touching a CGRect

In my cocos2d app I am trying to determine when a CCSprite is touched Here is what I have: -(BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event{ NSMutableArray *targetsToDelete = ...
0
votes
2answers
167 views

Falling images that can be pressed

In my cocos2d app I am trying to make images fall from the top of the screen and detect when they are pressed. I am having a hard time. Can anyone help me achieve this? Thanks.
2
votes
1answer
186 views

Game speed cubic growth

Is it possible, using delta in my update method to increase a game speed variable exponentially on cubic growth (the blue line below) My maths isn't great so I'm not sure how the formula would be ...
0
votes
1answer
468 views

Keeping the CCSprite on the screen

In my cocos2d app I have a CCSprite moving on the screen but it moves off the screen. How can I prevent the CCSprite from moving off the screen? Thanks
3
votes
2answers
2k views

Cocos2D: Upgrading from OpenGL ES 1.1 to 2.0

I have recently starting upgrading my ios game to the latest Cocos2D (2.0 rc), and I am having some difficulties upgrading my texture generation code to OpenGL 2.0. In the old version I generated ...
1
vote
2answers
301 views

How can I make a rectangle to an irregular shape?

I used masking for breaking an image into the below pattern. Now that it's broken into different pieces I need to make a rectangle of each piece. I need to drag the broken pieces and adjust to the ...
1
vote
1answer
147 views

Drawing texture does not work anymore with a small amount of triangles

When i draw lines, the vertices are well connected. But when i draw the texture inside the triangles, it only works with i<4 in the for loop, otherwise with i<5 for example, there is a ...
2
votes
5answers
2k views

Cocos 2D - Hold down CCMenuItem

I am using the following code to move a CCSprite left and right. -(id)init{ CCMenuItemImage * moveLeftButton = [CCMenuItemImage itemFromNormalImage:@"Move Left Button.png" selectedImage:@"Move ...
3
votes
1answer
3k views

Cocos2D 2.0 - masking a sprite

I have read this tutorial about how to mask sprites using Cocos2D 2.0. http://www.raywenderlich.com/4428/how-to-mask-a-sprite-with-cocos2d-2-0 But the author talks about OpenGL ES textures and ...
3
votes
1answer
446 views

Smoothing rotation

I've spent the last three days trying to work out how to rotate a sprite smoothly depending on the velocity.x value of the sprite. I'm using this: float Proportion = 9.5; float maxDiff = 200; float ...
0
votes
1answer
220 views

Rotation based on x coordinate and x velocity?

-(void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { float deceleration = 0.3f, sensitivity = 8.0f, maxVelocity = 150; // adjust velocity based on ...
0
votes
2answers
2k views

Top down water view, cocos2d

Has anyone successfully created a top down view of a stream/river? I need to also work out how to make it look like a boat is cutting through the water.
1
vote
0answers
249 views

Design pattern for procedural terrain assets

I'm developing a procedural terrain class at the moment and am stuck on the correct design pattern. The terrain is 2D and is constructed from a series of (x,y) points. I currently have a method that ...
2
votes
1answer
578 views

Xcode workspace with Unity3D as a sub-project?

Let's say we're developing a 2D game with Cocos2d-iPhone and UIKit and CoreAnimation. But we're also considering leveraging the 3D capabilities of Unity 3D. Is it possible that we add the ...
2
votes
2answers
1k views

Simple 2D Flight Physics with Box2D

I'm trying to build a simple side scroller with an airplane being the player. As such, I want to build simple flight controls with simple but realistic-feeling physics. I'm making use of cocos2D and ...
0
votes
1answer
2k views

How to simulate a water splash effect?

I need to achieve the effect of a ball falling down into a pool then splashing in the water. At first, I made a sensor to detect the collision between the ball and the water and then show the sprite ...
2
votes
1answer
375 views

Image 1 becomes image 2 with sliding effect from left to right?

I would like to show a second image appearing while a "door" is closing on my character. I've got my character in the middle of the screen and a door coming from the left. When the door passes my ...
-3
votes
1answer
166 views

iPhone game development [closed]

I am new to the iPhone game development. How can I develop a simple game by using cocoa2D. and I want to know more about Cocoa2D.
-1
votes
1answer
164 views

Make a CCSprite come up from bottom of the screen in intervals

I have a cocos2d iOS app. I have a CCSprite that I need to come up from the bottom of the screen every few seconds (like 2 or 3 seconds). How would I do this?
-1
votes
1answer
172 views

Slide down transparent CCScene

I want a transparent CCScene (or CCLayer) to slide down when the game is paused...and I want it to be clear enough to see the CCLayer behind it. How could I do this? Thanks
1
vote
1answer
491 views

Store and create game objects at positions along terrain

I have a circular character that rolls down terrain like that shown in the picture below. The terrain is created from an array holding 1000 points. The ground is drawn one screen width infront and ...
1
vote
2answers
595 views

Custom Fonts in cocos2d

I have tried Hiero but it has NEVER worked for me. Is there an alternative application for creating fonts for cocos2d? Thanks
2
votes
1answer
1k views

How To show document directory save image in thumbnail in cocos2d class [closed]

I have just implemented multiple photo selection from iphone photo library and i am saving all selected photo in document directory every time as a array, now i want to show all saved images in my ...
2
votes
2answers
239 views

Moving 2d camera in the y direction

I'm developing a simple game for the iphone and am struggling to work out the best way for the camera to follow the main character. The following picture hightlights the three main components: ...
2
votes
1answer
355 views

How can I load a large tile map with cocos2d?

I am try to design a cocos2d game with a big world. The world's tile map is very big, maybe 20 iPad screen sizes worth of tiles. I want to know how to load this using a CCTMXTiledMap? If I directly ...
1
vote
1answer
629 views

Running one action on multiple sprites simultaneously

I have created a spiraling animation for a football. I want to be able to run it on 2 sprites simultaneously. This is what I have done: CCAnimation* footballAnim = [CCAnimation ...
0
votes
1answer
374 views

Triangles in a C++ STL Vector as an Objective-C member sometimes draws incorrectly in OpenGL ES

The polygons draw correctly 80% of the time. When it fails, a vertex is dislocated. The polygon is consistently drawn with the wrong vertex. I checked that the vector is correct during initialization, ...
2
votes
1answer
456 views

Cocos2d particle system

I have a fire particle emitter in my project and I have it following a football. My goal is to make the football look like it is on fire but the problem is when I add it to the screen it can only be ...
3
votes
2answers
840 views

2D Animation Smoothness - Delta time vs. Kinematics

I'm animating a sprite in 2D with key frames of rotation and xy-positions. I've recently had a discussion with someone saying that when the device (happens to be an iPad using cocos2D) hits a ...
0
votes
2answers
1k views

Constant rotation of a revolute joint in box2d

I would like to have a line with one end attached to a location and have it rotate constantly (with the same speed) with a maximum of 45 to -45 degrees (i.e. I would like to have it swing like a rope ...
3
votes
3answers
3k views

Getting isometric grid coordinates from standard X,Y coordinates

I'm currently trying to add sprites to an isometric Tiled TMX map using Objects in cocos2d. The problem is the X and Y metadata from TMX object are in standard 2d format (pixels x, pixels y), instead ...
5
votes
1answer
496 views

Do I need to roll my own polygon segmentation algorithm to automate Box2d body creation from a tile map?

Before re-inventing the wheel I figured I'd ask: I'm working on a tile-based 2d-maze level generator for cocos2d + box2d. The idea is: I'm using one of the well-known graph traversal algorithms to ...
-3
votes
1answer
182 views

Simple question about a cocos2d based game template

I am learning a cocos2d based Game template tutorial from here and now I am at this point of the tutorial. My question is, how can i run 30 different scenes in 30 different levels of 5 chapter? Now I ...
0
votes
2answers
631 views

Adding gesture recognizer (or dragging) to CCSprite

I'm trying to allow a CCSprite to be dragged across the screen. I've succeeded so far by doing it on a Layer level (from this tutorial). However, this only allows ONE sprite to be dragged at a time as ...
2
votes
2answers
1k views

Issue with removing sprites on collision

I'm trying to make a very simple collision detection procedure just for test purposes. The problem is with the send/receive information between functions I have these lines on the update method ...
0
votes
1answer
141 views

CCSprite x and y comparison

I have 2 CCSprites and I want to tell if their x and y are equal I tried this: if(sam.position.x == tom.position.x && sam.position.y == tom.position.y){ NSLog(@"Hooray!"); } Although I do ...
0
votes
1answer
338 views

Moving a sprite accelerometer

Im trying to, in cocos2d for the iPhone, move a CCSprite (in this case "player" up and down (the app is in landscape). How can I accomplish this? I have been unable to do so. ex. ...
0
votes
1answer
536 views

what is the difference between CCSprite and a PhysicsSprite?

I am new to Cocos2D and I've realized that most of the codes written before the Cocos2d update used CCSprites. Recently I realized a lot of more recent codes after the update are using PhysicsSprite. ...
2
votes
0answers
372 views

how to attach a body to a rope and making it swing to another rope [closed]

I've set some ropes (using cocos2d and box2d) and would like to attach a body to one rope in such a way that it can swing to another rope. I am not sure how to go about this. I read making and object ...
0
votes
1answer
465 views

How do I manage the visibility of enemy spawn locations in a long scrolling shooter?

How do I handle the situation of an enemy spawn place being visible on a screen in a scrolling shooter? The tutorials I have seen are about setting all the enemies on a whole map only. But it is not ...
0
votes
1answer
261 views

Why set the position of both b2Body and Box2DSprite?

In a game, we add a body for each sprite, the method is: createBodyAtLocation:(CGPoint) forSprite:(Box2DSprite*)sprite In which we create the body and we attach it to the sprite in parameter: ...