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

0
votes
0answers
11 views

How to import Cocos2d-x in codeblocks ide?

Is it possible to import cocos2d-x in codeblocks just as in xcode ?? How can I do that ?
0
votes
0answers
5 views

cocos2d-x : set search path not working

im using cocos2d-x javascript and i tried to set search path or asset for multi resolution devices like so in main.js file if (cc.sys.isNative) { // if game is native assetsPath = ...
0
votes
1answer
26 views

wrongly scaled on cocos2dx 3.2 when render to multiple fbo (more > 1 deep)?

i have bug that only happen when retina flag disabled. i try draw multiple render texture to achive some multi post effect: so i have 3 render texture, fbo 1 for final pos effect fbo 2 for back ...
0
votes
0answers
13 views

Can't override velocity_func when compiling cocos2d-x JavaScript in IOS?

I am attempting to overwrite the Chipmunk's Body.prototype.velocity_func. It works perfectly when viewing my game via HTML5 Canvas, but when I compile my Xcode project, the velocity_func is never ...
0
votes
0answers
16 views

Can you create a PhysicsSprite in Cocos Studio?

I do not see the ability to enable Physics in any way in Cocos Studio, am I missing something or is this a current shortcoming of the application?
0
votes
0answers
27 views

Convert Cocos2d-x JS Sprite to PhysicsSprite?

I have a Cocos Studio project that has a node that contain multiple sprites. I am loading this node and iterating through the children (each are a cc.Sprite object); I'd like to convert each ...
0
votes
1answer
43 views

How to convert pixels to meters in Box2d with Cocos2d-x 3.5?

I am using Cocos2d-x 3.5. I created a simple game with edge bodies and one circular body to test box2d. Physics wasn't working well, so i thought i should convert pixels to meters and use that meters ...
0
votes
1answer
51 views

How to make TMXTiledMap responsive?

I've been struggling with Cocos2d-x (C++) and finally I got to the point I feel more or less comfortable with that. My game is a 2D car-based one, with a straight infinite map where I've finally been ...
2
votes
0answers
178 views

cocos2dx - Swipe and cut the sprite

I am trying to implement swipe and cut a sprite using cocos2dx and inbuilt chipmunk. For the solution I have done following things Enabled physics in the scene, so that the body falls on cut. ...
0
votes
0answers
44 views

Very slow motion smooth rendering - cocos2d-x

I have a a white circle that I move on a black background very slowly. When I look very carefully, I see that the while moving the edge of the circle is jittering. In my opinion it is because the next ...
0
votes
0answers
19 views

Setting Up the PTM_Ratio for Different Devices

I want to set the the physics for my Game and I have used Box2d for the Physics Simulation. And to do that I have set the PTM_Ratio to 32.0f.But When I run my Game on Different Android or iOS Devices ...
0
votes
0answers
15 views

cocos2dx - Bypass body contact

I am using cocos2dx and setup two Sprites with same Physics Body definitions see below PhysicsBody *physicsBody=PhysicsBody::createBox(size,PhysicsMaterial(1.0f,0.0,0.5f),Vec2(0, size.height*0.5)); ...
0
votes
0answers
28 views

Shader to mask image with polygon

I'm new to graphics programming and GLSL in particular. I'm working on a 2D game and the setup is as follows: There is an image on the screen (a sprite in the game engine [Cocos2d-x if it matters]) ...
0
votes
1answer
27 views

how to build release version mac cocos2dx?

do you know how to build mac build release version? in this case i use cocos2dx framework. in vs2013 we easyly choose the build version but in xcode i dont know. the indication release build is all ...
1
vote
0answers
85 views

Why current scene in cocos2dx has no children when accessed from outside scene class?

I want to access a sprite in a scene, but I cannot get the running scene from outside the scene class. The scene is created using: Scene* MyScene::createScene() { auto scene = Scene::create(); ...
0
votes
0answers
52 views

Cocos2dx How to show different parts of a scene in a split screen

I come from an SFML background and you could show different parts of a scene in split screens by manipulating sf::View. Is there any way to do it with Cocos2dx? I plan to make a split screen game but ...
1
vote
0answers
40 views

How can i get a value from object in tmx file in Cocos2d x 3.x?

I want to set my sprite in x coordinate based on an object in TMX map file, this is my code: tileMap = cocos2d::TMXTiledMap::create("ground.tmx"); ground = tileMap->layerNamed("ground"); ...
0
votes
0answers
50 views

How can i get object from TMXTiledMap and store it in Dictionary variable ?

I've been following a tutorial to make tiled map in cocos2d x 3.0 , but i couldnt complete the rest of the tutorial because its for coco2d x 2.0 version, How can i get a value of property that is ...
0
votes
1answer
47 views

Cocos2dx - Touch not recognized on Android

I'm having trouble with a touch listener not picking up touch events on android, but doing fine in windows (mouse input). I've got a Node listening for touches (not a Layer), but from what I've been ...
0
votes
1answer
83 views

Cocos2d - Physics bodies randomly loosing Velocity along an axis after impact

This just started occurring and seems to randomly happen during, and between, game sessions. A dynamic moving body collides with a static body and instead of bouncing off looses (almost completely) ...
0
votes
0answers
33 views

Mobile game: Optimization only working on some devices / Render big texture causes stuttering after level load

I'm currently optimizing the rendering of the background of my mobile game. The background consists basically of many colored dots. Since the background is static I'm able ro render the whole ...
1
vote
1answer
167 views

Cocos2dx+Chipmunk: Fully elastic collision between moving bodies

I'm using Cocos2dx and the built in Chipmunk physics engine, and currently I've got my PhysicsBodys' materials set up with: Density=0 Restitution=1 Friction=0 in order to get fully elastic ...
0
votes
1answer
48 views

How to serve user generated levels? [closed]

What is the easiest way to store online and serve user-generated levels? What client-server architecture should I use? Will I need backend code, or just a database? What database would be the easiest ...
1
vote
1answer
78 views

Right-To-Left Text Direction in Cocos2dx

I want to use Persian/Arabic text beside English in whether Label or ui::Text. Persian is a Right-to-Left and English is a Left-to-Right language and so I have problem to combine them in one string. ...
1
vote
0answers
211 views

How do I use CC_CALLBACK for external classes in Cocos2dx v3.2?

I've been having problems with using 'CC_CALLBACK_#' (i.e. CC_CALLBACK_0, CC_CALLBACK_1). It works alright if I am using it to call a function from the class (Using 'GameScene' class for this example) ...
0
votes
2answers
365 views

Counting multiple touches using Cocos2dx 3.2

I'm trying to count the number of active touches in screen in order to perform an an action in case that there are two touches: auto jumpListener = EventListenerTouchAllAtOnce::create(); ...
0
votes
0answers
108 views

Cocos2d pause game freezes the screen

I am trying to create pause screen for my game. The game is developed upon continuous scrolling background (top to bottom) with obstacles which are moving independently (left to right). Below is the ...
0
votes
2answers
244 views

Drawing a continuous line with onTouchMoved callback

i'm trying to draw a continues spline on every onTouchMoved call, the functionality is supposed to be similar to the line drawing used in the iOS game - flight control. i'm using it in the following ...
0
votes
0answers
107 views

Playing Multiple Sound effects isssue in cocos2d-x

Please help if someone faced this issue. I have a sound effect 3sec long which need to be played repeatedly for some time of 10 to 15 secs. Implemented like below: ...
0
votes
1answer
502 views

Need Help with Cocos2d Ver 3.3 AudioEngine

So I have 2 audio files that I want to play at different times: background.wav a sneeze.wav. I believe that I have to convert both wav files into mp3, caf and ogg files. Then I do this: static ...
2
votes
1answer
711 views

Cocos2d-x supporting multi-resolution using density independent pixels

Is there a way to use Density Independent pixels(dp) in cocos2d-x? I am developing an Android game using Cocos2d-x 3.0. The Android reference ...
0
votes
0answers
618 views

Implement Camera (former: CCCamera) v2 in cocos2d-x v3.3

we want to port camera code from cocos2d-x version 2 to version 3.3 with the goal to imitate the behaviour of a CCCamera in cocos2d-x version 2 exactly. You can assume that values for "eye" and "up" ...
2
votes
1answer
95 views

change animations when touch sprites [closed]

In the following function I want to change the animation when I touch on the button. But the game crash and exit. What's wrong with this code ? bool GameScene::onTouchBegan(cocos2d::Touch *touch ...
1
vote
1answer
93 views

How can I obtain information about the GPU in Cocos2d-x?

I'm trying to obtain information about the GPU that is running the game in order to use the correct texture compression for that GPU: std::string GPUInfo::getTC() { std::string TC; ...
1
vote
1answer
404 views

having problem with preloading plist file in Cocos2d-x

I am using Cocos2d-x engine with 3.2 version. In my splash screen i am prefeching plist by below line SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ui.plist"); Now inside game when ...
-1
votes
1answer
142 views

How to optimize my lighting shader?

I want to create a lighting effect on a gray-scaled world using cocos2d-x. What I've done is creating a layer which runs a shader program that receives light positions and radiuses as input and ...
0
votes
2answers
280 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
162 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(); ...
0
votes
1answer
456 views

Randomize and display sprites in a 4x6 grid - Cocos2d-x

I am creating a card matching game. I have a vector that stores 16 unique cards. I am trying to randomize the order and select only the first 12 cards, then setup in a 4x6 grid for a total of 24 ...
0
votes
0answers
34 views

applyImpulse on CCSprite not making realistic moves

I am developing a jump game, in that when tapped on screen, I need to make the player jump up. So, I used following code. [_player.physicsBody applyImpulse: ccp(0, player.physicsBody.mass * 155)]; ...
0
votes
0answers
185 views

Touch-detection in cocos2d-x (Lua): Catering for bounding boxes and scale factor

I am trying to write an app in Cocos2d-x with Lua. I have a sprite that I have added directly to a scene, and now I want to detect touches on the sprite. Right now, my touch begin function looks as ...
3
votes
1answer
409 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
130 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
60 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
1answer
132 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
1answer
363 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 ...
3
votes
2answers
568 views

Implementing one-way platforms in Chipmunk

I am making game in cocos2d-x, but it's the first time I am using a physics engine i.e. Chipmunk. (It's built-in to cocos2d-x.) I want to make a one-way platform: When my character jumps into a ...
1
vote
0answers
93 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 ...
1
vote
1answer
298 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
16 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 ...