Skip to main content

Questions tagged [cocos2d-x]

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.

Filter by
Sorted by
Tagged with
2 votes
1 answer
765 views

Physics bodies randomly losing 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) ...
2 votes
2 answers
921 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 ...
1 vote
1 answer
2k 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 ...
0 votes
0 answers
28 views

Build Fails while building for cocos2d-x 3.17 on Ubuntu 22.04

While building the game (cocos2dx- 3.17 on ubuntu 22.04) it fails with below error - ...
0 votes
1 answer
378 views

Cocos2d-x setContentSize, setScale give poor graphic quality

I want to create sprite with size is relative to the screen size. I.e: Sprite size is equal to screen width * 0.2. I use setContentSize and ...
0 votes
1 answer
342 views

How to detect collision during a cocos2d::Action

I spent a day trying to hack my own Action class, but given the hurdles I've hit trying to do so, I'm hoping there's some way to work around my problem while still using the built-in (and admittedly ...
1 vote
2 answers
380 views

How to keep same aspect ratio in different devices with cocos2dx?

I have been making a board game and I am using cocos2dx. There are two scenes for now, One is main menu and the other is gameplay scene. When I run the apk on tablet with EXACT_FIT resolution policy ...
1 vote
1 answer
662 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 ...
6 votes
3 answers
2k 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: ...
8 votes
1 answer
1k views

Why the AnchorPoint doesn't affect the `CCLayer` Positioning?

I think there is a difference between the CCLayer and CCNode behavior when I change their AnchorPoint. I will describe what I mean and please somebody explain it. Scenario: I start with ...
1 vote
1 answer
63 views

Player stays grounded when jumping at the side of a two tile high wall

I am currently developing a simple Super Mario Bros. like platformer in Cocos2d-x v2. I am now at the step of doing wall sliding with two axis-aligned bounding boxes (tiles) but I've not quite found ...
0 votes
1 answer
348 views

Cocos2d-x build failing on linux

I was trying to compile cocos2d-x on my linux machine, because they do not provide a binary copy of the library. However, I received the following error during the build: ...
0 votes
1 answer
881 views

Cocos Creator - orientation change event in native build for iPhone and Android

I am making some Hybrid app which has some native part in Both iOS and Android and common functionality (which includes and games/animation and UI) which I make in Cocos Creator. The problem I am ...
2 votes
1 answer
468 views

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

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
1 answer
615 views

How to implement a Trail using Cocos2dx

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 ...
1 vote
1 answer
715 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: ...
5 votes
2 answers
3k views

How do I create a message box that fires a callback on button press?

I need to create a message box with an "OK"-button. When the user touches the button, it should execute a callback. I'm new to this and couldn't find any articles in the docs.
0 votes
1 answer
164 views

Cocosdenshion and Android not working

I'm trying to play sounds and music with cocos2d. When I run on iPhone and .caf files the audio is perfect, but on Android it is not playing the background music and is only playing 2 sounds of 10 ...
1 vote
1 answer
808 views

Shooting Projectiles

I am using cocos2D-x and am trying to achieve the effect of enemies going past and shooting projectiles at the player who is moving around the screen. I am using the code below, which is based on this ...
0 votes
2 answers
475 views

Full-screen window hangs when debug break or crash (Windows/GLFW/Cocos2D)

I run into an issue if my game application becomes unresponsive when running in fullscreen on Windows. This mostly applies when I want to use breakpoints in Visual Studio, however if the application ...
1 vote
2 answers
530 views

Can I create custom framebuffer and render to it in cocos2dx?

I want to do post processing effects so I was thinking If I could just make custom framebuffer in cocos2dx like OpenGL and render the ALL SCENES objects in it. I want a single frame buffer for all ...
2 votes
1 answer
3k views

How to use Audio Profiles in Cocos2d Ver 3.3 AudioEngine

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: ...
1 vote
0 answers
2k views

How to connect to a socket.io server from a Cocos2d-x game?

The question can also be asked more specifically as; How do I connect to a socket.io server with C++ from a mobile game? I am aware of Boost (and Socket.io C++ client libraries using Boost) but ...
2 votes
0 answers
63 views

What is the right way to implement a loading screen in cocos2d-js?

We have two scenes that are loaded with heavy computation; a map screen and a puzzle screen. When we change the scene from A to B, the app gets stuck on scene A for a while before it renders scene B. ...
1 vote
1 answer
3k views

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 a plist by below line ...
2 votes
3 answers
1k views

How to get `Label::createWithTTF` to support RTL languages such as Arabic

Firstly, I'm using Cocos2d-x v3.6, Visual Studio 2013 uses(UTF-8 without signature option) and ...
-1 votes
2 answers
364 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
1 answer
13k views

How to set up Cocos2d-x for visual studio?

I want to make a cocos2d-x game. I read you can use any IDE, so I was planning to use Microsoft Visual Studio 2015, since I want to make my game primarily for Windows. I have been searching for ...
0 votes
1 answer
203 views

Resource protection in cocos2d-x 2 and 3

I am developing a game in cocos2d-x 2.2.3 and I want to protect my resources from being extracted. Is there any way I can do this? I don't know much about encryption.
0 votes
0 answers
31 views

Cocos2dx- how to box2d cannot move through each other?

player box2d ...
4 votes
2 answers
2k 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: ...
4 votes
1 answer
429 views

Handling animations in a Platformer

I'm developing a 2D platformer game using the Cocos2d-x Engine, i can load correctly the animations according in which action the player is(running, jumping, standing, etc). Now i'm trying to add the ...
0 votes
1 answer
458 views

Circle to Circle Collision of moving Sprites

i needed help attaching circle1 Sprite to circle2 Sprite on collision onto the same point where they are getting collided, and both circles are moving with Action. Like this, Attaching means, when ...
0 votes
1 answer
319 views

How can I rotate childrens nodes with parent node in cocos2dx?

Consider the following code... ...
7 votes
1 answer
1k views

Puzzle game: clipping of non-convex polygons on the figures

I have an original figure in the SVG file. I need to break it randomly on parts, an example of which is specified below: I have an idea, to use for partitioning Voronoi diagram (Fortune's algorithm). ...
0 votes
2 answers
848 views

Cutting up a Sprite sheet to frames

I'm new to game development, so please be kind if this is a very simple question. I have a Sprite sheet with 18 frames of the same character (6 col x 3 rows) moving slightly. I want to get the frames ...
7 votes
1 answer
2k views

Train-like movement in a 2D game

I am developing a 2D game using Cocos2d-X in C++ language. In my game, I need to implement train movement. Here is the image about the output I want to achieve: I tried to do the above moment using ...
1 vote
1 answer
289 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 ...
0 votes
1 answer
336 views

Assets from Tiled background layer not appearing in Cocos2d-x

I'm running into an issue with a Tiled map used as a background image for a scrolling scene. I'm using two sprite sheets to provide assets for a background layer. In Tiled, all of these assets appear ...
0 votes
2 answers
2k views

translate-scroll repeated 2d texture using opengl shader

I managed to implement an infinite 2d texture scrolling using the following shader. btw I'm using cocos2d-x 2.2.1. The vertex shader: ...
1 vote
0 answers
614 views

Correct way to move player in cocos2d-x chipmunk platformer

I'm attempting to make a physics based 2d platformer in cocos2d-x using the built in chipmunk physics engine. I've not used a physics engine before and I'm having some issues setting the correct ...
1 vote
1 answer
157 views

how to make a ball move in opposite direction when hitter to ball or paddle

I had set angle but it's not correct and I'm not getting exactly what I needed. The ball should bounce when hit to paddle or border and move in opposite direction. I'm writing the code in c++. I had ...
1 vote
2 answers
308 views

Get different result on different devices (same resolution) after setVelocity

I'm dying with physics , i've tried to use setVelocity however i got slightly different value from different devices. I've tested on iPhone 5 (on simulator) and ...
4 votes
2 answers
2k 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 ...
1 vote
0 answers
188 views

Cocos2d-x : Socket.io-client-cpp crashes after creating scene

I'm using https://github.com/socketio/socket.io-client-cpp with cocos, because the built-in socket.io doesn't support callback (http://discuss.cocos2d-x.org/t/doesnt-work-with-socketio-2-0-1-and-...
3 votes
1 answer
1k views

Cocos2d Sprite 3D position

When I set a position3D for a Sprite in cocos2dx, it render two times the same sprite, i took a screenshot: I set the position3D because i want to use the Z position the give an effect of distance, ...
0 votes
1 answer
194 views

Camera Calculation

For my game I don't able to decide what camera resolution I have to use ? Normally I use 1024x600 landscape resolution of camera for my game and create single graphics for my game. But I found that ...
3 votes
1 answer
429 views

How can I provide a mechanism for users to increase the gameplay speed?

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
0 answers
228 views

How do I add a 3D sprite over a TMX background using Cocos2d-x?

We have been working on sample game, in which we want to show a 3D sprite on a background loaded from a .tmx file. But the 3D sprite is never showing up, though we ...
0 votes
3 answers
544 views

Why does selecting a tile return a negative coordinate?

I created a class template named PlayField<T>, where T is the type of the GridObject. ...

1
2 3 4 5