Questions tagged [cocos2d-android]

JAVA version for Android development. Cocos2D is an open source framework for building 2D games and graphical applications. Cocos2D-Android and Cocos2D-Android-1 are the two active projects.

Cocos2D for Android is a Java based open source framework for building 2D games and graphical applications. Cocos2D-Android and Cocos2D-Android-1 are the two active projects. The latter is a branch of the former and seems more active.

Both Cocos2D for Android engines are based on the API design of Cocos2D for iPhone, but they are not compatible with each other (Java vs Objective-C).

For more information on the other Cocos2D game engines, see the and tag descriptions.

It is recommended to use the following tags appropriately:

  • Use the tag on questions referring to the Objective-C based framework
  • Use the tag on questions referring to the C++ based cross-platform framework
  • Use the tag on questions referring to the JavaScript based framework
  • Use the tag on questions referring to the Java based frameworks
  • Use the tag on questions referring to the Python based framework
  • Don't use any of the above tags together in the same question, unless your question refers to more than one Cocos2D engine. For example, if you ask "How to port from Cocos2d-iPhone to Cocos2D-x?" you should include both and tags.
398 questions
2
votes
1 answer

How to handle key input with cocos2D in Android?

Is there a simple way to handle key inputs from within the layer? I know with touch inputs you can just use ccTouchesEnded. Is there a similar function for keyPressed? If not how would you go about getting the key press?
2
votes
1 answer

cocos2d vs andengine for isometric game?

Are cocos2d-iphone and cocos2d-Android the same thing? in other words, can I make a game once and deploy it to both devices? Also, for Android, "overall" what is the best isometric game engine (cocos2d or andengine)? I want make an isometric…
Josh
  • 819
  • 1
  • 14
  • 30
2
votes
0 answers

Cocos 2dx control playback speed of currently playing audio effect

Hi I am playing a sound effect in a cocos game using this method from SimpleAudioEngine Is there a way to control the playback rate (speed up or slow down) of this audio at runtime. int playEffect(const char* filePath, bool loop = false, …
javaDeveloper
  • 1,403
  • 3
  • 28
  • 42
2
votes
1 answer

Cocos2d-android CCMenu does not respond to touch

import org.cocos2d.events.CCTouchDispatcher; import org.cocos2d.layers.CCColorLayer; import org.cocos2d.layers.CCLayer; import org.cocos2d.layers.CCScene; import org.cocos2d.menus.CCMenu; import org.cocos2d.menus.CCMenuItem; import…
Nick Rempel
  • 3,022
  • 2
  • 23
  • 31
2
votes
0 answers

What is the purpose of runOnUiThread in Android games?

Cocos2d-x (3.17.1) uses GLThread and any operations happening on the engine are run on GL Thread. runOnGLThread method is used to evalString JavaScript from JAVA. We have developed an Android game using Cocos2d-x JS. There are a lot of JavaScript to…
Vyshnav
  • 56
  • 2
  • 7
2
votes
2 answers

Setup environment for android sdk to run cocos2d sample programs.

I want to install cocos2d to develop game in android .. so can anyone help me how to install that on android sdk ? Please Suggest me steps to install it.... if any other tool is available for android development then please suggest me .. Thanks ..
Chirag
  • 56,621
  • 29
  • 151
  • 198
2
votes
2 answers

Is this typically how Java interfaces are used to set up event handlers, and are there hidden drawbacks to this approach?

Hey all, I'm still relatively new to Java, and looking for a sanity check. I've been studying this Java port of Cocos2D and noticed that the CCLayer class has built-in hooks to the Android native touch events. That's great, but what I'd really…
scriptocalypse
  • 4,942
  • 2
  • 29
  • 41
2
votes
0 answers

How to integrate Admob with Cocos Creator 1.3.x

I was wondering if anyone that have used cocos creator have ever managed to integrate admob banner in it. I followed this dcoumentation I found online but my app first crashed and on 2nd attempt, ads appears white on screen and can't progress on…
Chelseawillrecover
  • 2,596
  • 1
  • 31
  • 51
2
votes
1 answer
2
votes
1 answer

Cocos2dx. How to get length of 1cm(in real life) in pixel for any screen resolutions?

I have admob banner set up at the bottom of the screen. I want to offset everything so that nothing is covered up by the banner. I have no idea how to get the height of the admob banner DYNAMICALLY. For iphone4, 120 is the height of admob, but for…
2
votes
1 answer

(Cocos2dx-v3) Android - How to solve "cocos2d.h: No such file or directory"?

In terminal at my cocos2dx project directory, I typed $ cocos run test -p android and comes this error log. [armeabi-v7a] Compile++ thumb: MyGame_shared <= main.cpp [armeabi-v7a] Compile++ thumb: MyGame_shared <= AppDelegate.cpp [armeabi-v7a]…
Joon. P
  • 2,238
  • 7
  • 26
  • 53
2
votes
0 answers

HTTP response code -1 cocos2dx android

So I'm using cocos2dx's HTTPRequest and here is my sample code: cocos2d::network::HttpRequest * request=new cocos2d::network::HttpRequest(); request->setUrl(strUrl.c_str()); …
cessmestreet
  • 2,298
  • 3
  • 22
  • 42
2
votes
1 answer

string.find failed on Chinese character in Android but success on PC when developing cocos-lua game

I try to use string.find("中国", "中"). It successed on PC but failed on Android when I develop my cocos-lua game. on Android, string.find return nil Fristly, I think their encoding may be diffent, so I try to print out their byte. on Android: text1:…
Sam
  • 964
  • 3
  • 11
  • 24
2
votes
1 answer

Does Cocos2d-js use a webview?

I need to know if the cocos2d-js (cocos2d javascript) could build a real native application and not just use a webview to display the content. what i exactly need to know, if the animations and all parts of the game logic will be transformed to some…
2
votes
1 answer

How to send object info in cocos2dJS to android logcat?

We want to display object info (id,coordinates,tags) in the android logs. Is there there any generic way of displaying the required info in the logs ? Something like extending cclog or adding alternative classes.