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
22 views

Cocos2d v3 - addChild method make performance problems

i have currently a performance problem with the addChild method in cocos2d version 3.3. My scenario is currently that i have about ten CCNode which holds a bundle of other CCNode (about 500), i called ...
0
votes
0answers
13 views

cocos2d-js displays only one type of tile from a tmx file

I am using Tiled to produce a tmx which I use in my code using cocos2d-js. The problem is that when I run it on the browser, a wrong tile gets displayed, the first one of the image (0,0) and repeats ...
0
votes
1answer
13 views

texture2d in cocos2dx 3.2 error in windows phone

I have GameSprite class inheritance from Sprite class. GameSprite *sprite = new (std::nothrow)GameSprite(); if (sprite != NULL&&sprite->createWithSpriteFrameName("child1.gif")) { ...
0
votes
1answer
14 views

Cocos Code IDE unable to find python

I am trying to create a new JavaScript project on Cocos Code IDE but every time it immediately give me the error message: Unable to find python. Please, click the setting button to set the python ...
0
votes
0answers
14 views

How to prevent fish eye effect when using CCOrbitCamera in Cocos2D?

Note: I'm using CocosSharp, a Xamarin C# version but the question is valid for all Cocos2D versions I presume. I'm also fine with answers in any Cocos2D dialect (there is no tag yet for CocosSharp ...
1
vote
1answer
36 views

How can I run two CCActions in parallel and another one afterwards with Cocos2D?

With Cocos2D I can run two actions in parallel by simply using runAction and I can use a CCSequence two run several actions after each other. However what I could not find is: Run two actions ...
0
votes
1answer
61 views

Cocos2dx - Physics - Abort() When Changing Dynamic PhysicBody to Static?

I just learned cocos2dx v3.3 integrated chipmunk physics engine. Here ,as you see, I create a simple circle with physic as: auto sprite = Sprite::create("circle.png"); auto body = ...
0
votes
1answer
40 views

cocos2dx: Your RunningScene != Scene You just Replace

I have this code for cocos2d-x 3.x: void MainMenu::StartGame(cocos2d::Ref* pSender) { auto director = Director::getInstance(); auto newScene = Scene::create(); ...
1
vote
1answer
33 views

How can I use CCClippingNode to trim the top and bottom from a CCTableView?

I'm fairly new to Cocos2d and struggling with sizing a CCTableView. How can its height be controlled so that I have space at the top and the bottom? I'm trying to visually wrap the top and bottom of ...
0
votes
0answers
26 views

Using Tile Maps with cocos2d - how do I handle a large amount of images?

I am building a game where the users (players) can build their own town. There they can build houses, add furniture to the houses etc etc. Basically similar to The Sims. I am using the Tiled Map ...
5
votes
1answer
210 views

How to read a color of a pixel from texture (cocos2d-js)?

How to read a color of a pixel at [x,y] from a texture (in cocos2d-js)?
0
votes
0answers
55 views

Cocos2D texture distorted on android devices

The textuers are distorted (randomly) on some devices (randomly again). The game is working on IOS without problem. Checked adb logcat and I got some errors. Searched the errors but not found any ...
0
votes
2answers
194 views

How is the environment moved in endless runner games like Tiny Wings

I've always wondered how the background seen is scrolled endlessly as the main player is moving (usually to the right). With Tiny Wings I suspect that it's somehow drawn dynamically because when ...
1
vote
0answers
43 views

Implementing debug “overlay” info

This question is actually about GameEngine2D which is part of PSM SDK (for PlayStation Vita development), however as stated in documentation it's loosely based on cocos2d library. I hope that my ...
0
votes
1answer
57 views

Scrolling effect after touch

i'm making map for a game and need to make scrolling of map, so the main thing what i need is to calculate speed and move layer after player remove finger from screen. I make it my own, but i think ...
0
votes
2answers
77 views

Isometric projection start point

I have a question about isometric projection: Why did in all tutorials and examples start point for isometric is in left top corner ? For example in cocos2d 3.1 my start screen point in left bottom, ...
1
vote
0answers
167 views

UI rich Strategy/RPG UI - 2D Game Engine or UI Toolkit? [closed]

I'm on the fence regarding the graphics engine of my current game and hope for some advice. This is an UI heavy strategy/rpg. Although the game is played on a (simple) 2D map, it is largely turn ...
1
vote
0answers
131 views

How to change texture from pvr.ccz in Cocos2d?

I'm using .pvr.ccz file that texturePacker application created for me , I created a Sprite that it's image choosed from this file(.pvr.ccz) like below: CCSprite *mySprite = ...
0
votes
0answers
106 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
172 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 ...
2
votes
0answers
157 views

Why AnchorPoint doesn't affect `CCLayer` Positioning?

I think there is a difference 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
41 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
1answer
112 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
46 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 = ...
3
votes
1answer
133 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
169 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
72 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
100 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
votes
1answer
468 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
256 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 = ...
3
votes
1answer
2k 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
77 views

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

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
178 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
170 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
182 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
28 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
126 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
524 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 ...
1
vote
1answer
642 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
1answer
90 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
66 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? ...
-2
votes
2answers
351 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
134 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
137 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
156 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
104 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
53 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
137 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
194 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
135 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.