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

1
vote
3answers
899 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 ...
3
votes
2answers
845 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
105 views

Cocos2d savegame cctmxtiledmap

my game features several tilemaps that are initially loaded from a tmx file and modified during gameplay. How can I save the changed tilemaps in a save game? Will NSCoding do the trick here or is the ...
-1
votes
2answers
110 views

Move Sprite Up ad Down using accelerometer

my sprite can move up and down but some probs are there....... sprite is moving slowly , i want some speed in moving the sprite sprite is not continue move but jumping ..... sprite can not touch ...
3
votes
1answer
295 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 ...
1
vote
1answer
179 views

Need a bounding box for CCSprite that includes all children/subchildren

I have a CCSprite that has CCSprite children, and those CCSprite children have CCSprite children. The contentSize property doesn't seem to include all children/subchildren, and seems to only work for ...
1
vote
1answer
510 views

Retrieving latest touch to interrupt another

In Cocos2D for iPhone, I want the latest touch event to interrupt another and ignore the last touch. Let me know if I need to elaborate more, but basically my game consists of a lot of finger ...
0
votes
1answer
363 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 ...
0
votes
1answer
334 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 ...
-1
votes
1answer
411 views

How can I solve these errors when using SimpleAudioEngine?

I want to use SimpleAudioEngine for the music in a cocos2d game I'm working on. When I import SimpleAudioEngine.h in my game layer I get syntax errors in CVPixelBuffer.h and CMFormatDescription.h. ...
-3
votes
1answer
169 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 ...
2
votes
0answers
131 views

How to achieve 'forward' movement (into the screen) using Cocos2D?

I'm interested in creating a 2.5D first-person shooter (like Doom) and I currently don't understand how to implement the player moving forward. The player will also be able to browse around the world ...
2
votes
0answers
248 views

Box2d based tile map game scrolling problem

I am using a tile based game and also used a joystick. Using joystick sprite body move perfectly but tile map can not scroll. -(void)setCenterOfScreen:(b2Vec2)position { int ...
2
votes
0answers
212 views

how to attach a body to a rope and making it swing to another rope

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 ...
1
vote
0answers
130 views

iOS cocos2d - sprite gets stuck in collision detection

I'm developing a top down game in cocos2d and I have collision code that checks collisions between enemies and the player so that they don't go through each other. The code seems to work but the ...
1
vote
0answers
166 views

Can I use a shader with 2 different textures in Cocos2D (x)?

We are evaluating a variety of different graphic engines for use in our game and we want to be able to use 2 different textures for many of our sprite maps. One sprite map would be the standard RGBA ...
1
vote
0answers
575 views

How to properly add texture to multi-fixture/shape b2Body

Hello to everyone this is my first poste here I hope that will be not fail start. At start I must say I make part 1 in Ray's Tutorial "How To Make A Game Like Fruit Ninja With Box2D and Cocos2D". But ...
1
vote
0answers
248 views

Bezier curve sample code on touches moved

i am searching for any sample code to draw bezier curve by using touches, if any one have links or sample code please help me. i am developing the game like flight control in that i have to move my ...
1
vote
0answers
165 views

Getting contour without the background

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
0answers
206 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 ...
1
vote
0answers
196 views

How to load big size CCTMXTiledMap in cocos2d?

I am try to design a cocos2d game that with a big world. The wolrd tiled map is very big, maybe 20 ipad screen sizes. I want to know how to load CCTMXTiledMap into screen? If I directly add it to ...
1
vote
0answers
240 views

Zoom Layer centered on a Sprite

I am in process of developing a small game where a space-ship travels through a layer (doh!), in some situations the spaceship comes close to an enemy space ship, and the whole layer is zoomed in on ...
1
vote
0answers
139 views

How do I control an animation with a drag command?

I want to play an animation when someone drags a sprite from it's default position to another selected position. If they drag half of the selected position then animation will be play half. For ...
1
vote
0answers
155 views

Which is the best model to present the destruction of the building in Box2D?

We'd like to create a "world-destruction" game. The problem is in choosing the best model for building destruction. On my mind the building would be an array of objects( tiles). Each object would ...
1
vote
0answers
467 views

Cocos2d and Body with few collision shapes using chipmunk

I'm using Cocos2d (0.99.5) with chipmunk physics engine. Currently I'm trying to place a body into space which is combined from few circle shapes. Let's say I have a corresponding sprite image with ...
0
votes
0answers
37 views

Catching an object from sky in Cocos2d and Box2d world

My world has a gravity of -9.8 and there are KDynamicBodyType bodies falling from the sky. At the bottom there is a PhysicsSprite with KinematicBodyType. I want the PhysicsSprite to be able to catch ...
0
votes
0answers
45 views

GetReactionForce().y does not show 0 even it has no weight

I have built a simple structure with static and dynamic bodies and revolute joints. None of the bodies have weight, I've set the density to 0. Here's the structure: In screen update method I do ...
0
votes
0answers
73 views

cocos2d - exclude GUI layer transformation

I have a game layer that should be pannable and pinchable and a GUI layer as an overlay that's excluded from the transformations. I added the pinch and pan gesture recognizer to the view and set the ...
0
votes
0answers
106 views

Detect Sprites, they are in Shape or Not which random draw in Cocos2d

I have searched a lot on web and found some of help ful links as exact my question. Link 1 Link 2 But still i am not success to achieve this, i have done some of code lines, as like draw line by ...
0
votes
0answers
107 views

Cocos3d-iOS: Need ideas for approaching a 3d app development

I am trying to develop a Cocos3d application, not a fame. This application is exactly same as flash view available in this link-> http://www.amfam.com/learning-center/my-home/interactive-home.asp and ...
0
votes
0answers
111 views

CCLabelTTF value is not updating (cocos2d)

i have two layers control layer which contains CCLabelTTF for score, and first layer in which i detect collision btwn my objects. i want to update score (i.e CCLabelTTF value) in control layer from my ...
0
votes
0answers
241 views

Cocos3d lighting problem

I'm currently working on a cocos3d project, but I'm having some trouble with lighting and I have no idea how to solve it. I've tried everything and the lighting is always as bad in the game. The ...
0
votes
0answers
97 views

Create an avatar in cocos2d using CCsprite

I am working with cocos2d game. In which i want to create avatar using sprite. Means we can change clothes of character, change the cap, change body color etc. i want some good tutorial if it is ...
0
votes
0answers
104 views

How to create move button for movement of box2d body continous

I have some problem regarding movement of box2d sprite body.Problem is when i press left button than my sprite move left and when i release button my sprite will stop. I know the logic of movement ...
0
votes
0answers
55 views

limiting a sprites movement after a mouseJoint is released

I have created a weldJoint between two sprites and I also created a method (spritePositionRelease) that returns the exact position of a sprite when a mouseJoint is released. I want to track the ...
0
votes
0answers
235 views

How to make and correctly use progress bar in cocos2d-iphone?

I have a game that uses a progress bar to inform player of level of certain stats of the player. For example hunger, when it starts at zero and slowly adds up to maximum bar. When he eats the hunger ...
0
votes
0answers
97 views

Using same b2World in different classes/Layers

How can we use same b2world in different classes in our game.. ? I am having two classes gameLayer and weaponLayer respectively. I am trying to use the b2world I am using in gameLayer in weaponLayer ? ...
0
votes
0answers
223 views

Carousel level selector

In my cocos2d game I need the user to select a menu so I was hoping that they could use a carousel (like the one in ski on neon or sonic racing for the iPad). I realized that there is nothing for this ...
0
votes
0answers
61 views

Creating a contact listener with sprites from different classes

I've been trying to set a contact listener that creates a joint on contact between two sprites which have their own classes. Both sprites are inheriting from NSObject and they are initialized in their ...
0
votes
0answers
141 views

Clear edged sprite

I am a newbie to cocos2d. I would like make user to draw similar to what a painting brush would do. I am using CCSprite for that. I almost implemented the velocity, color and opacity factors for that ...
0
votes
0answers
32 views

Cocos2d copied actions not responding?

I am running an animation on 2 sprites like so: -(void) startFootballAnimation { CCAnimation* footballAnim = [CCAnimation animationWithFrame:@"Football" frameCount:60 delay:0.005f]; spiral = ...
0
votes
0answers
194 views

Export POD format from 3D Max to cocos3D

we're developing a Medical app with a 3D character thats teachs about phisioterapy. We have a 3D character in 3D Studio Max with animation, when export it into POD (I Have tried many configurations) ...
0
votes
0answers
109 views

Coco2d boundingbox and performance

I am playing around with Ray W's whack-a-mole tutorial (http://www.raywenderlich.com/2593/how-to-create-a-mole-whacking-game-with-cocos2d-part-2) to try to learn Cocos2d. However when i decrease the ...
0
votes
0answers
143 views

Schedule update problem

This might sound pretty straightforward. I've created a method and I've called it as below in the init method. [self createNewSpr:ccp(s.width * 0.25,s.height-200)]; [self createNewSpr:ccp(s.width * ...
0
votes
0answers
206 views

detect sprites by tag in parallax

I've created 3 layers and added to a parallax node in my game play scene; I don't know why it crashes when I'm enabling touch, self.isTouchEnabled = YES; on one of my layers; I want that touch to be ...
0
votes
0answers
1k views

How to animate a Cocos2d sprite in a shake-like motion (earthquake)?

Does cocos2d (iPhone) have an action/animation to shake/vibrate a CCSprite? Of course I could build a CCSequence to do that, but I thought that cocos2d may already have such an animation implemented. ...
-1
votes
0answers
25 views

Applying the vector of a swipe movement to a box2d object

Hi I'm trying to achieve game functionality where the player can place their finger on an object then swipe in a certain direction and apply the speed and velocity of the swipe to the object they have ...
-1
votes
0answers
34 views

How to make askew slope image(b2body) in Box2d?

I am new in Box2d and learning myself. I am learning Box2d from here http://www.box2d.org/manual.html#_Toc258082972 I want to make a body and want to give b2body a angle so that it will look like ...
-1
votes
0answers
46 views

How to move a PhysicsSprite

I'm trying to move a PhysicsSprite from left to right based on where the user clicked. I understand that a simple Sprite can be moved by MoveTo functions but what is a way to move a PhysicsSprite? ...