Questions tagged [cocos2d-x]

1

votes
0

answer
112

Views

Error Execution failed for task ':app:transformClassesWithDexBuilderForDebug'. when compile apk from cocos2dx project

I'm new with cocos2d-x. I've stuck in this error for two day, when I compile my project, this showed up : * What went wrong: Execution failed for task ':FlappyBird:transformClassesWithDexBuilderForDebug'. com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilde...
nguyen nam
1

votes
1

answer
102

Views

cc.game.restart() carsh when extend sdkbox in cocos2d-js 3.10

I have an issue and need help. Oh, I realize not only every sdkbox facebook but also just install a sdkbox plugin (like facebook, onesignal ...), all are crashed when calling cc.game.restart(). In AppDelegate.cpp: #ifdef SDKBOX_ENABLED sc->addRegisterCallback(register_all_PluginFacebookJS); sc->addR...
Phạm Nguyên
1

votes
0

answer
146

Views

can cocos creator use native c library?

I know Android lets dev to use .so for native code. Is there a way to do the same in cocos creator? The native library has c and c++. I have access to them so building them to a different format that cocos creator use will not be an issue, but that's all I can do with those native code. I can't copy...
user1865027
1

votes
0

answer
96

Views

Tearing with cocos2d-x on PC at native resolution, fullscreen, 60fps

I'm programming a game with cocos2d-x for Windows, Linux and MacOS (for the moment I develop and test on Windows 10). I already have a system to change settings (either fullscreen or windowed with different resolutions but always a ratio of 16:9). I've implemented a prototype of my levels system, wi...
nyr1o
1

votes
1

answer
103

Views

Impossible to store cocos2d::Animation * in a std::vector of structure?

I work on a project made with cocos2d-x framework (c++). In my Player class, I have to manage the animations. Iinitially I had this code that worked without any problem: First, the animation object is a cocos2d Class cocos2d::Animation. Just remember that this object contains a cocos2d::Vector _fram...
Pierre Dommerc
1

votes
1

answer
59

Views

Cocos2dx. Conditional action

I want to create player moving using actions. I created function void move(float x, float y); That function creates actions RotateTo and MoveTo. I want to move player only if angle between its forward and target - forward is less that some value; I tried to add runAction(moveAction) in if condition...
Herrgott
1

votes
0

answer
970

Views

How to decrypt and decompile luac-file from cocos2d-x framework?

I know that the lua version is stored in the 5th byte of the luac file (the header). Here's the first few bytes of a luac file I have: 6D 6D 64 64 74 32 The 5th byte is 74. Is My Luac file LuaJIT bytecode? I am trying to decompile this file and receive this error by using unluac Exception in thread...
Nam Vu
1

votes
1

answer
44

Views

Cocos2d-x TiledMap, return a nullptr when invoking getLayer() to get the collision layer?

I have been struggling with the null pointer for hours! It happened when I used the getLayer() method to get a layer from the tiled map in cocos2d-x (the tailed map is edited using the Tailed Map Editor). map = TMXTiledMap::create('map/map1.tmx'); map->setAnchorPoint(Vec2(0.5, 0.5)); map->setPositio...
PPPatrick
1

votes
1

answer
39

Views

Cocos2d make physics body passable by anything

I'm trying to make a static physics body that can be passed by anything like it isn't there (like an ordinary sprite). Infinite restitution doesn't work apparently. Is this possible? I'm trying to simulate climbing a ladder so I need to handle the contact while also making the ladder passable by the...
Bogdan
1

votes
0

answer
26

Views

cocos2d causes app to drop all touch and volume control events if the phone is locked while the app is starting

I extend Cocos2dxActivity, and in the onCreate, I am showing a DialogFragment with some GDPR stuff in it. The only lifecycle events that my custom DialogFragment overrides is onSaveInstanceState() and onCreateDialog(). My dialog does have a button.requestFocus when it starts. If the phone screen is...
lbenedetto
1

votes
0

answer
153

Views

Is there a way to stop the AURemoteIO thread from the AutioToolBox from performing its polling tasks?

So I am using cocos2dx new AudioEngine, and I am having this crash: https://github.com/cocos2d/cocos2d-x/issues/18948. 0 0x0000000184a5cea8 in CrashIfClientProvidedBogusAudioBufferList () 1 0x000000018493f270 in AudioConverterConvertComplexBuffer () 2 0x0000000184939460 in AUSpatialMixer::Rend...
downstroy
1

votes
0

answer
71

Views

Cocos2d-x shader scene transition effect not working as expected on iOS

I'm working on my very first game and I'm finally at the end of development, but I've run into a small problem with one of my shaders. I'm not very good at working with shaders at all, so my ability to solve problems related to them is still very limited. Anyways, it's an effect that tries to mimic...
xerosugar
1

votes
0

answer
38

Views

Cocos RichElementText mis aligned inside RichText if enableRetina true on mobile browser

I am using Cocos2d-x 3.13.1, on game start I am calling cc.view.enableRetina(true). But, due to this, ccui.RichElementText inside ccui.RichText is mis-aligned. misaligned screenshot: If I set cc.view.enableRetina(false), cocos renders blurred fonts. Blurred fonts screenshot: This is happening only...
Suhas Patil
1

votes
0

answer
16

Views

Strange dotted line in Cocos2d / Python

I'm trying to create a single straight line using Cocos2d with Python. Why in this code, I get a random dotted line? import cocos from cocos.director import director from cocos import draw class TestLayer(cocos.layer.Layer): def __init__(self): super().__init__() line = draw.Line((0, 0), (550, 450),...
Rogério Dec
1

votes
0

answer
15

Views

Cocos2d-x run action - clicked button

enter image description here When I click on the button it will perform the action help me. it did not work SpriteFrameCache::getInstance()->addSpriteFramesWithFile('run.plist', 'run.png'); const int numberSprite = 6; auto gameSprite = Sprite::createWithSpriteFrameName('run1.png'); gameSprite->setPo...
Review game
1

votes
2

answer
1.4k

Views

C++ static const multiple declaration error in Eclipse for Android NDK

I've read the similar questions, but the one that answers mine applies only to VisualStudio. I am using Eclipse and developing an Android application using Cocos2d-X, which is a framework that uses Android's NDK. I created a class named Config, which contains all of the application's constants such...
cesar
1

votes
1

answer
820

Views

Eclipse + Android + Cocos2d-x: Why does the emulation only work once?

I am just starting to learn cocos2d-x for Android, and understand how to create a new project (using create-android-project.sh), compiling the native code (using build_native.sh), then importing it into Eclipse as a new Android project (New > Android Project > From source...). The first time I run t...
Phil
1

votes
1

answer
707

Views

how to access assets directly in android NDK - cocos2d-x

I want to read some json files in android ndk ! problem is i could not find any tutorials that describe direct access to assets in ndk (most of them say i should pass pointer from java code to native but i cant use that ) I also tried to find some example about but again no luck!
Ocelot
1

votes
1

answer
257

Views

How do I make part of layer to disappear when it moves to certain part of the screen in cocos2d-x

I'm currently using CCScrollLayer in cocos2d-x to scroll my list of items but I want the part of the list to disappear before it goes out of the screen. I've tried transparent layer with higher z value but that didn't work since the layer was transparent and the list still shows up. I'm guessing I h...
Jae
1

votes
1

answer
714

Views

random time WIN DEATH: in cocos2d-x

I developed a game with cocos2d-x. I tried to compile it under android. The first three scenes are good - but when I added the last functional, the application begins to close at random times and in random scenes. Here is the relevant log: 04-18 15:30:54.404: I/DEBUG: * * 04-18 15:30:54.404: I/DEBUG...
MaRinat
1

votes
1

answer
334

Views

CCSpriteFrame's gone when Android device go into sleep

I'm using cocos2d-x and I'm satisfied using this awesome stuff. I'm using CCSpriteFrameCache with some plist files. but When I press the sleep button of my Android device and back to game again, It seems like loading all sprite frame again!! I noticed because It needs 3~4 seconds to back to game fr...
Bright Lee
1

votes
1

answer
1.1k

Views

Cocos2d-x Parse XML from Content of URL using pugixml, how do I do it?

This is what I've been trying: pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file('Book.xml'); // need to change this std::cout
user1235155
1

votes
3

answer
365

Views

Can I disable multitouch for a Windows Phone Application?

I'm currently working on a game for Windows Phone 7, using the XNA version of Cocos2d. Due to the rules of the game, I need it so that the user can only touch one thing at a time but multitouch seems to be always in effect. Additionally I don't know if this is a Cocos error, but it also causes the g...
user1475782
1

votes
1

answer
644

Views

How to make a CCParticleExplosion non-repeating?

I'm using cocos2d-x and I can get a CCParticleExplosion firing mostly correctly, but I'm looking for a way to enable it to burst its particles just once and not repeat. I can try to hack this together with duration/life settings, but I'd rather be able to specify this explicitly. Is there a way to...
vargonian
1

votes
1

answer
283

Views

NSUInteger Equivalent for use in cocos2d-x project

Is there any macro for NSUInteger implemented in cocos2d-x for use in visual c++. I need this to port a project from obj-c to c++. And also , I have seen these variables written after the declaration of the variables in the header file : @property (nonatomic, readonly) CGPoint stickPosition; @pro...
srikanth chitturi
1

votes
1

answer
1.3k

Views

Cocos2d-x replace Texture repeatedly

in Cocos2d-x, I want to swap sprite's texture repeatedly. my swap function is below... void GameScene::swapSpriteTexture(CCSprite *a, CCTexture2D *b) { CCTexture2D *tmp = a->getTexture(); a->setTexture(b); b = tmp; } and I call the function liks this, this->swapSpriteTexture(aSprite, m_TextureSlot)...
Jinbom Heo
1

votes
2

answer
1.1k

Views

Access the Main Scene / Layer from a class

I have 3 different classes Tree, Fruit, and Basket. Each of them have their own CCSprite member that I access through getSprite( ) ( each class has its own getSprite( ) ). Also, each class has a draw( ) method which sets the CCSprite's texture, position, and other CCSprite related stuff. When I make...
alxcyl
1

votes
1

answer
1.1k

Views

How to send sms from Android NDK or Cocos2dx

I want to send sms from cocos2d-x engine.If this engine can't send sms, does Android NDK support it? Anyone can help me? Thanks.
Trần Sĩ Long
1

votes
2

answer
3.7k

Views

How to create .apk from HelloWorld sample of Cocos2dx?

I am using Windows 7 x64, cygwin, Eclipse Juno cpp, jre6, android ndk r8b, latest cocos2dx for windows. I have tried this tutorial link. http://www.cnblogs.com/ybgame/archive/2012/06/07/2540693.html I have overcome the error. But unfortunately, the Eclipse builder don't generate the .apk file. The c...
Agung Pratama
1

votes
1

answer
927

Views

What all to take care about for memory leak in cocos2d-x?

Hello I want to know what all I should take care about for memory leak in cocos2d-x. I am taking care of all the objects created by me i.e. using core C++ but how to take care or manage the code in cocos2d-x to avoid memory leak ? What about actions,sprites and all ? Please give me reason also so i...
user1201239
1

votes
3

answer
2.8k

Views

How to detect touches on child sprites

I'm writing a cocos2d-x application. I have a sprite with a couple of child sprites over it. These sprites represent one logical object on the screen that is transformed as a whole object. Now, when the object is touched, I need to discover which of the child sprites was touched. The problem is that...
FireAphis
1

votes
1

answer
1.7k

Views

Exception when running cocos2dxsample project(Raywenderlich tutorial Cocos2D-X for iOS and Android)

I am following Cocos2D-X for iOS and Android: Getting Started tutorial from Raywenderlich site. I have downloaded the android project from create-android-project.sh command as stated in the site. When I try to run the project in eclipse I got the following logs: 09-26 13:04:05.081: W/dalvikvm(517):...
MKB
1

votes
1

answer
3.6k

Views

Can't Set Up Cocos2dx [Android, Eclipse, Windows]

After I have set up the cocos2d-x development environment for Android in Eclipse on Windows through this tutorial, I thought I have settled everything down and ready for development except I can't copy the sample project into my own workspace .. (Still Can't) .. But, later I found this tutorial, ....
Aung Pyae
1

votes
1

answer
3.5k

Views

cocos2d onEnter, onExit

eg) 1. When X sprite is touched, pointer of X is stored in class Y 2. when X sprite is removedFromParent, X sprite will notify Y that it's going away How do I achieve the second step? Specifically, onExit(of class X) is a good place to do this kind of stuff? When does onEnter/onExit get called? I do...
eugene
1

votes
1

answer
3.4k

Views

cocos2d-x: Rotating CCSprite while moving changes it's final position

I'm trying to make an animation for my game, of an ant leaving it's nest. It should descend the nest going right and down, facing down and then look straight again. I created two sequences of actions, one for moving and the other for rotating and put them together in a CCSpawn. If I execute only the...
bakkay
1

votes
1

answer
1.1k

Views

How to setup cocos2dx for android on MacOs Lion?

I am trying to setup cocos2dx with eclipse on a MacOs Lion. I am following the tutorial below: http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started When I try and execute the ndk build shell tool i get the following error: Davids-iMac:~ davidcavanagh$ /Users/davidcavanagh...
DMC
1

votes
1

answer
584

Views

How to send data via HTTP get in Java?

So, I am going to connect to a servlet via an iphone and use HTTP. I am actually developing a multiplayer game and would like to know how I can send specific data to the iphone via HTTP get in java (doGet). I am using libcurl on the iphone (cocos2d-x). Here is how my code is set up: size_t write_da...
dgTheUser
1

votes
1

answer
1.9k

Views

Box2d with Cocos2d-x ball is not getting bounced with accelerometer

Ball is not getting bounced what am I doing wrong ? here is the class #include 'GameLayer.h' USING_NS_CC; GameLayer::GameLayer(){ mWorld = NULL; mBody=NULL; mBall=NULL; } GameLayer::~GameLayer(){ delete mWorld; mBody=NULL; delete mBall; mBall=NULL; } bool GameLayer::init() { if ( !CCLayer::init()...
user1201239
1

votes
2

answer
1.6k

Views

How to port Cocos2dx-wp8 from Application (.exe) to Dynamic Library (.dll)

I've been going at this problem for almost a week now and I still have 700+ errors. Definitely need all your help! Thanks. Problem: Need to use Cocos2dx for Windows Phone 8 in my C++/DirectX Visual Studio 2012 project that also uses C#/XAML UI. Given: Cocos2dx-wp8 as an Application .exe project dow...
Lisa
1

votes
1

answer
1.3k

Views

Marmalade: better using Cocos2d-x v.2 or Cocos2d-x v.1?

we are developing a game using Marmalade SDK and Cocos2d-x version 1.0.1-x-0.13.0 beta (2012-03-29). At the time we started working on the game, this version of Cocos2d-x was the only one to include marmalade platform support, so it was a forced choice, but currently it seems that also cocos2d-2.1be...
Fuzzy Mind

View additional questions