cocos2d-x is a cross plaform port of cocos2d-iphone using C++. It supports iOS, Mac, Android, Samsung Bada, BlackBerry Tablet OS, Windows and Linux. It has built-in bindings for Lua and Javascript.

learn more… | top users | synonyms

3
votes
0answers
83 views

How do I handle rope physics with fixed ends and a sliding weight?

I've been interested in rope physics recently—I've successfully implemented a simple Verlet rope with moveable ends. Now I am trying something a little different: I want to start by recreating the ...
0
votes
0answers
7 views

Cocos2d-x 3.0 JS: Facebook Dialog: Internal Server Error 500

I am using the following function to Invoke Facebook sharing: facebookShare: function() { cc.log('share to facebook 0.1'); var self = this; var fb = plugin.FacebookAgent.getInstance(); ...
0
votes
1answer
32 views

using rperp or perp to find perpendicular of a vector

i have code local coordinate Vec2 velo = Vec2(100,0); Vec2 Heading = velo.getNormalized(); Vec2 side = Heading.perp(); Vec2 trans = Vec2(12,12); then i can generate toWorldCoordinate for trans ...
0
votes
0answers
30 views

Use other IDE then Eclipse on OSX for game dev with Cocos2dx for Android

I've started with cocos2dx 3 days ago and already having a massive pain in my "back" with this support of C++ that eclipse provide me. It support it a little bit more then notepad++, and after years ...
0
votes
0answers
19 views

Cocos2dx - Trail

I'd like to implement a trail (like the white circles in Angry Birds) that chase my Sprite. I already used CCMotionStreak, but the trail texture is "stretched" instead. Anyone has an idea how to make ...
0
votes
0answers
18 views

Cocos2d-x how to draw in specific free form area

Here https://github.com/mikeccy/cocos2dx-finger-paint/blob/master/Classes/HelloWorldScene.h and https://github.com/mikeccy/cocos2dx-finger-paint/blob/master/Classes/HelloWorldScene.cpp you can see how ...
1
vote
0answers
47 views

Render isometric TMXTilemap with antialiasing method

I'm currently working on a cocos2d-x project that uses isometric tile maps.all the tiles are as small as 64*64 px.So I have to scale the map up a little bit.TMXTilemap is handy but its render method ...
0
votes
1answer
68 views

Playing a sprite sheet animation in Cocos2D-x

I'm trying to create an animation using a sprite sheet in Cocos2D-x. I'm doing the following. The game doesn't crash but the screen is still blank. bool HelloWorld::init() { ...
0
votes
0answers
14 views

How can I animate a sprite in cocos2d-x 2.2.1 c++? [duplicate]

Is there a way to do an animation without a .plist file? I'm having a hard time doing swap animation with sprites. For example, doing an animation while the user is not doing touches and the other ...
1
vote
1answer
92 views

cocos2d-x “immediate mode”?

I have some c++ game code that draws the game state on each game-loop cycle in "immediate mode". By that I mean that the game code does not add the sprites to be drawn to any sort of "scene graph" or ...
2
votes
2answers
147 views

Water silhouette shader using GLSL

I have this problem to solve using Cocos2d-x 3.x: In my game there is water represented by rectangle texture, modified by the code on the go. I also have a character moving around, rotating etc. I ...
0
votes
1answer
145 views

post on Facebook from cocos2d-x on windows phone

Is it possible to share/post on Facebook from cocos2d-x on windows phone. Is there any example/tutorial available.
0
votes
0answers
42 views

Change of scene not working in Android

Hi i am trying to load a new scene in cocos2d-x-js version 3.0 and my code works fine in the windows simulator but on building to android it doesn't work. This is the code var scene = new ...
0
votes
1answer
140 views

How can i create a message box with callback on ok?

I need to create a message box with ok button and when user touch ok , it will have to execute a callback.I am new to this and couldn't find any articles in the doc.
0
votes
0answers
43 views

how can i remove CCSprite on click which are came from right to left direction…?

i am using cocos2dx 3.0(c++) and have many sprites generate from on sprite named "objDown". each generated sprite has a setTag() assign ...no w how can i remove this sprites on touch ....help will be ...
1
vote
0answers
78 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
3answers
87 views

Is this possible in cocos2dx 3.0?

I have a number of five images (sprite1.png, sprite2.png, sprite3.png, sprite4.png, sprite5.png), these all I want to add as a sprite... int rndSprtNum = (arc4random() % 5) + 1; for(int i = 0; i < ...
0
votes
0answers
333 views

CocoStudio + cocos2dx 3.2 correct way to import animation?

After many frustrating hours I came to the conclusion that there is no valid way to implement a cocostudio animation, as CCArmature is deprecated and didnt work for me anyway. CocoStudio.h and ...
0
votes
0answers
75 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
23 views

Add spritenode to the side of other spritenode

i have create a spritenode space. i want to add one sprite node to the left and one sprite node to the right of the space node. space= Sprite::create("space.png"); ...
0
votes
0answers
107 views

How to create a rectangle sprite node in cocos2d-x

I am new to cocos2d-x. I want to create a rectangle spritenode with specific size in cocos2d-x. As in spritekit we use "bodyWithRectangleOfSize", what is its equivalent in cocos2d-x. I am using ...
0
votes
2answers
59 views

Filling up the empty blocks when the player touches the safe zone again! using cocos2d

Hi guys i am stuck with filling up the data of all the blocks which are empty like the ones in the image. As you can see there i have a pacman like object where i will be moving around. But when ...
0
votes
0answers
115 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
88 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
170 views

Import JSON from CocosStudio to 2dx?

I'm new to Cocos2d and trying to figure out how to use CocosStudio v1.5 for animation along with learning Cocos2dx . I'm hoping to put all the animation for one character on one sprite sheet and one ...
0
votes
0answers
78 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, ...
3
votes
1answer
110 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
134 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
50 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 : ...
1
vote
1answer
159 views

Box2d - Attaching a fired arrow to a moving enemy

I am firing an arrow from the player to moving enemies. When the arrow hits the enemy, I want it to attach exactly where it hit and cause the enemy (a square) to tumble to the ground. Excluding the ...
0
votes
0answers
116 views

Cocos2dx InApp Purchase for ios

I am trying to integrate In App Purchases in my app made by using cocos2d x c++. I am using easyNdk Helper for In App Purchases. My In App Purchases works perfectly for my Objective C apps. But for ...
-1
votes
1answer
265 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
112 views

Cocos2d-x v3.1 for WinPhone 8 auto change texture after resumed from background

I have some sprites in my game (for Windows Phone 8). These are my steps to reproduce the problem: Open game Play (this is an optional step) Press Windows button to send game to background Press ...
2
votes
0answers
196 views

Weird y offset when using custom frag shader (Cocos2d-x)

I'm trying to mask a sprite so I wrote a simple fragment shader that renders only the pixels that are not hidden under another texture (the mask). The problem is that it seems my texture has its ...
0
votes
1answer
196 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 = ...
1
vote
1answer
299 views

How to prevent showing outside of Game Map ( Cocos2D-x ) ( Scrolling game )

I'm trying to make a tower defense game and it can zoom in/out and scrolling over my world map. How to scroll over the game and how to restrict it not to show outside of my map(black area). At below ...
3
votes
1answer
1k 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
469 views

How to make glow effect in cocos2dx

i searching the web for glowing effect , i like to be able to create misc glowing effects , like lasers , glow around sprites and such . couldn't find any thing on the web , any body have any ...
1
vote
1answer
254 views

Issue porting Cocos2d-x to Android

I've written a basic game using Cocos2D-x on XCode. It works fine on the iPhone. Now I'm trying to port it to Android. When I run the script ./build_native.sh inside the proj.android folder, it gives ...
-1
votes
1answer
248 views

in-app purchase in cocosSd-x 3.0

I am working within a team, and we're at the point of finishing our first cocos2d-x c++ application. We want to add in-app purchases. for what, we made a search for this. We found 2 solutions: 1- ...
0
votes
0answers
44 views

What aspect ratios and resolutions should my mobile game target? [duplicate]

I used cocos2d-x to create a game. How do I need to set up the art so it works on different devices? How many aspect ratios and resolutions should I slice the same image to have it look good on iOS ...
0
votes
1answer
201 views

Cocos2d-x 3.0 animation frame by frame

As I know animations are actions. Now I need to play animation frame by frame. Say I have an animation from N frames. each frame should be played after t delay. Now I want to play animation frame by ...
0
votes
0answers
138 views

Require game logic like temple run

I am new at game development but I have done some work in cocos2dx for iphone. I am interested to develop a game like temple run. I read that temple run is 2D game feel like 3D but I believe that I ...
1
vote
0answers
69 views

What's the equivalent of UIBezierPath in Cocos2d-x?

I'm beginner in Cocos2d-x , and i want to implement this tutorial with Cocos2d-x v.3 cpp, but the problem i dont know if there's UIBezierPath in cocos2d-x. Could you help me to draw the Bezier Arrow ...
0
votes
1answer
439 views

using eclipse instead of visual studio for cocos2d-x project

im using coco2d-x v 3.0 i made a new windows project to test it and it is working but when i try to build and run a project using this command cocos run -p win32 it is print this error it seem ...
0
votes
1answer
152 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
348 views

Cocos2d-x , setup the debug environment and remove the red marks in my eclipse

I am struggling with this issue since last week. I still can’t figure out where is the error. My code is compiling perfect if I restart the eclipse. but, when I edit the c++ file it shows red marks ...
0
votes
0answers
94 views

Trying to make a mouseJoint with Box2D on Cocos2D-X

I'm trying to obtain this result: http://appcodingeasy.com/Gideros-Mobile/Dragging-Box2d-object-in-Gideros-Mobile (there's a video - YouTube). But I'm missing something, because if I follow the code ...
1
vote
2answers
356 views

Best logic to create and drop new gems in a Match-3 game

In a simple match-3 game, with a square gems matrix creating and dropping new gems is fairly simple: when needed I generate those gems above the matrix and then I make them fall into the main matrix ...
1
vote
2answers
337 views

How do I separate testable game logic from my UI in Cocos2d-x?

I read some articles on why I should separate game logic and UI code: That makes it possible to test game logic code can be independently of the rest. However, I am having trouble implementing this in ...