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

learn more… | top users | synonyms

0
votes
0answers
31 views

Is there any advantage in using sprite sheets in Cocos2d-X menus?

I am developing a game using Cocos2d-X 2.3 and Marmalade SDK 7.3.1 and I was wondering if there is difference between loading the icon images that will be used in my menu buttons from a sprite sheet ...
0
votes
0answers
27 views

cocos2d-x .. How to detect which sprites are underneath a touch event

I was wondering what the best solution is in the following scenario: Lots of sprites floating around on screen. A user can touch one sprite and drag to another sprite. Throughout this entire time, I ...
1
vote
0answers
15 views

Why AnchorPoint doesn't affect `CCLayer` Positioning?

I think there is a different between CCLayer and CCNode behavior when I change their AnchorPoint. I will describe what I mean and please somebody explain it ? Scenario: I start with CCNode CCNode ...
0
votes
0answers
13 views

CCTextField won't appear

I can't seem to add a CCTextField in my physics node, I tried all different methods, but it's still not happening. Here's my code: CCTextField *tf = [[CCTextField alloc] init]; tf.contentSize = ...
0
votes
0answers
39 views

Error running an Action in Cocos2d-x

In my game I have a "rocket" type and I want to run a sequence of actions on it. At first it must run an explosion animation and then remove itself from the game. For this I used the following code, ...
0
votes
0answers
12 views

Maintaining a constant magnitude of speed of a CCNode's physics-body after collision with a static body

I have two CCNode class "Baffle" and "SmashBall" with there physics bodies. Here are the PhysicsBody details of Baffle // Defining the physics body CCPhysicsBody * physicsBody = ...
-1
votes
0answers
35 views

How to fill a sprite with a pattern image in Cocos2D-X v3?

I'm searching for a solution on how to fill a sprite with a pattern image. I have searched on google and many websites/forums but I've only found solutions for Cocos2d not Cocos2d-x v3. Many thanks ...
2
votes
1answer
62 views

How can I speed up cocos2d game engine?

I am developing a tower-defense game and I want to permit user to change game engine speed ,for example rotation speed of towers,rockets speed ,enemies moving speed ,counters and etc proportionally. ...
1
vote
1answer
57 views

Cocos2d/Cocos2d-x Attaching an arrow (sprite) to another body sprite (person)

I am trying to set up a simple bow and arrow game. When the arrow hits the enemy body, the arrow's body is deleted and the arrow sprite continues to update, keeping the position correct in relation to ...
0
votes
0answers
15 views

Animate a tile in coco2d-x

I am trying to animate a tile in my tile-based game using coco2d-x 3.0 I am using tileAt(ccp(x, y)) to retrieve my tile Sprite been when I am trying to apply animation an assert is jumping with : ...
0
votes
0answers
40 views

How to get location of sprite placed on rotating circle in Cocos2d android?

I am developing a game using Cocos2d, and I got stuck when trying to find the location of a sprite placed on a rotating circle on the background. When I hit at a certain position on the circle it's ...
1
vote
1answer
88 views

How to pause and unpause the Particular action of a sprite?

My game has a sprite representing a character. When the character picks up an item, the sprite should stop moving for a period of time. I use CCbezier to make the sprite move, like this: ...
0
votes
1answer
74 views

How do I rotate a sprite with ccbezierTo in cocos2d-x?

In cocos2d-x, I move a sprite with ccbezierTo like this: // use for ccbezierTo bezier.controlPoint_1 = ccp(m_fish->getPositionX() + 200, visibleSize.height/2 + 300); bezier.controlPoint_2 = ...
0
votes
1answer
234 views

difference between cocos2d-x vs cocos2d-js

I'm just moving towards native apps... A friend of mine told me to start with cocos2d, I'm good in javascript. while searching google for cocos2d, and within cocos2d-x.org i found cocos2d-x ...
0
votes
0answers
50 views

iOS + cocos2d: how to account for sprite's position for the different device dimensions in an universal app?

All the questions I've seen regarding iOS universal apps (with or without cocos2d) deal with the "how to add graphics to a universal app". My question is, how does the code need to be written to ...
1
vote
1answer
63 views

applyAngularVelocity causes error when called right after object instantiation

I'm trying to make a physicsBody rotate as soon as it is instantiated. CCNode* ball = [CCBReader load:@"Ball"]; [ball.physicsBody applyForce:force]; [ball.physicsBody ...
0
votes
0answers
90 views

Cocos2D v3 and Physics simulation on server

I'm trying to develop a real time multiplayer game using Cococs2d v3. The game is basically a side scrolling racing game. I wanted to develop the client using Cococs2d for iPhone, and the server side ...
0
votes
1answer
105 views

Determine speed of sprite

I'm trying to calculate the speed of my sprites in Cocos2d but I'm having some difficulties. I'm not sure which units of time/speed cocos2d uses. My background sprite moves 2 positions to left each ...
0
votes
0answers
17 views

How to use CCGrid3DActions in Cocos2d-XNA?

For example, I want to add a CCLiquid action to my player shield in my game. In my Player class: public Player() { // code snippet when creating new Player CCSprite shield = new ...
0
votes
1answer
76 views

Mobile: Physics and movement actions

I've been using spritekit for a while for a few small games. One thing I've noticed is that spritekit is the first game framework I've used that allows me to apply move actions to physics bodies. ...
1
vote
1answer
181 views

Cocos2D - Fill a Sprite with a pattern

I have a CCSprite with a certain shape in Cocos2D and I would like to fill it with a pattern, as seen here: I've seen a lot of examples where they fill a rectangle with a pattern, or even a ...
0
votes
1answer
305 views

Preload in cocos2d v3

I'm trying to create a preload, but i don't know how to implement the code of this topic in cocos2d iphone v3. Since CCTextureCache has changed to CCTexture, and doesn't have sharedTextureCache ...
0
votes
0answers
51 views

Get Facebook Picture in Cocos2d-iphone V3

I'm trying to get the profile picture from Facebook, but I'm getting the following error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage ...
1
vote
1answer
57 views

Clay Jam continuous path/tap

I saw this game Clay Jam, that the user can create a path in the sand. The path is a continuous one, and it can varies from a single point to curves. How one can develop smooth and continuous paths? ...
0
votes
2answers
230 views

How can I locate the frames of a spritesheet PNG based on this PLIST data?

Someone asked me to reskin a certain game. Now he only sent me the whole sprite PNG and PLIST files of the sprites. He instructed me to rename each sprite with the same name corresponding to each ...
0
votes
0answers
88 views

Do SpriteBuilder's Smart Sprite Sheet need to be loaded to memory?

When I create an Smart Sprite Sheet Folder using SpriteBuilder and publish it, must I load that SpriteSheet into memory "FrameCache" with code or does SpriteBuilder do this automatically (so I just ...
2
votes
2answers
96 views

Finding diagonal objects of an object in 3d space

Using Unity3d, I have a array which is having 8 GameObjects in grid and one object (which is already known) is in center like this where K is already known object. All objects are equidistant from ...
0
votes
1answer
123 views

Particle effect in sprite

I want to create a particle effect when my player sprite collide with my star sprite. How can I add a particleSystem in the sprite and not in a image? Also, I wish if it could wait for the animation ...
-4
votes
1answer
93 views

How can I develop a game for iOS? [closed]

I have a Mac arriving in the next few weeks, and plan to program a 2d game. I know a little bit of Java but nothing about Objective C. I've heard about cocos2d -- it seems good but I don't know ...
1
vote
0answers
50 views

Building a guided tracing scene

I'm trying to figure out an approach to creating a cocos2d scene that would help kiddos learn to draw letters of the alphabet. Right now I am just using Apple’s PaintView demo code and applying an ...
-1
votes
1answer
120 views

How to swap the position of two sprites? [closed]

I'm making a game like Candy Crush with Cocos2D in Android. I've made the sprites but I want to swap to sprites by touch . How to swap the position of two sprites?
1
vote
1answer
136 views

Dynamic Hills like Contre Jour in Cocos2d

I'm interested in maps/environments which are flexible and change at runtime, such as those in Contre Jour. I have looked for a long time to find out how to make this effect, but I couldn't find an ...
0
votes
1answer
107 views

Walking Sprite animation Cocos2D [closed]

I am new to cocos2D development. Basically I want to develop game in which i want to move sprite forward with walking kind animation, must look real. Any help will be appreciated.
0
votes
1answer
78 views

How set and count Angle of sprite (turret) object in portrait mode in cocos2d?

I am new in cocos2d.I follow Raywenderlich tutorial series. I wish to set turrets in below of the screen in portrait mode.when user touch that location fire bullet and turret fire position at the ...
0
votes
0answers
174 views

Cocos2D - Simulating infinite scrolling

I have a BIG problem!! I want to make something like old space shooter games like “Asteroids”, where the ship, when going out of the screen, is reappearing at the other side. For example, when the ...
0
votes
1answer
62 views

Create body on a sprite (box2D)

I'm quite experimented in objective C, but now i'm tried cocos2D and his features. I need to add a body on a spritesheet (if possible on a classic 'UIImageView'), in order to detect collisions after. ...
0
votes
3answers
318 views

How can I create a tile set that will allow me to render a soccer pitch in perspective?

I am making a soccer game that needs a large pitch image (the whole play field area is about 3300 * 1200 pixels). I know I should use the Tiled map editor to create a tile map so that I can create ...
8
votes
2answers
442 views

What is the standard way to synchronize sound effects with sprite animations?

Let's take a situation where you have an RPG with spells and each spell animations have a different number of frames and they have very different requirements for sound effects. Let's assume that each ...
-1
votes
1answer
104 views

Collision function calls before colliding

My Box2D contact listener class is calling post solve and beginning the contact function before colliding? This is causing my object to bounce back before hitting the ground. What could be causing ...
4
votes
1answer
67 views

Can I create cocos2d animations without using Xcode?

I need to have someone do animation work for an iOS game I'm developing (using cocos2d), however this person does not have a Mac and as such cannot run Xcode. Is there a way for them to create ...
0
votes
1answer
258 views

cocos2dx- set draw() method interval time

What is the default interval of draw method call in cocos2dx engine? Can we set it manually? I couldn't find much information about it online. After researching a bit I found that update() method ...
0
votes
0answers
437 views

Cocos2dx- Draw primitives(polygons) on Update

In my game I'm trying to draw polygons on on each step i.e. update method. I call draw() method to draw new polygon with dynamic vertices. Following is my code: void HelloWorld::draw () { ...
1
vote
0answers
353 views

Cocos2d-x CCFollow Zooming issue

Hi I am currently building a cocos2d-x game which incorporates pinch zoom using CCLayerPanZoom class which can be found here The problem is basically when using CCFollow and zooming and out, it ...
1
vote
1answer
113 views

How can I set a system's emission rate using Particle Designer 2.0?

In cocos2d-iphone (2.1), CCParticleSystem has a property called emissionRate. Is there any way to set it using Particle Designer 2.0? I've tried all the various settings but there doesn't seem to be ...
-2
votes
1answer
352 views

how to predict enemy postion to shoot bullet same kingdom rush

i'm doing a tower defense game same kingdom rush, enemy can run curve not only linearly. i found this link : 2D tower defense - A bullet to an enemy but this link use only for enemy run linearly. ...
0
votes
1answer
200 views

Tile Maps and vertexZ order for sprites

Here is the setup. I have a orthogonal tile map made with Tiled. There are 5 layers. The bottom 4 comprise the background, while the top layer is the foreground that I will refer to as the “tree” ...
0
votes
0answers
124 views

Game issue occur in 4.3 Android Version?

CCScene doesn't show anything on 4.3 version? I am working on a project in which I'm using the cocos2d_android.jar and on the 4.3 version the screen goes blank and music/ccTouches/others things ...
0
votes
1answer
258 views

cocos2d collision detection between two ccsprites i am using boundingBox but this method is not working [closed]

I am making a cocos2d side scroller and I am currently putting collision detection in. I have an enemy that shoots at the player. I want to have the bullets disappear when they hit the player. The ...
0
votes
2answers
87 views

How to define axis of Sprites in a CCAnimation?

I'm struggling to find how to define a kind of axis in my frames, when my sprite punches it moves back. I want to define the head as a pivot for the other sprites with different sizes. How can I ...
3
votes
1answer
900 views

Pixel Perfect Collision Detection in Cocos2dx

I am trying to port the pixel perfect collision detection in Cocos2d-x the original version was made for Cocos2D and can be found here: ...