cocos2d-android

Images handling in cocos2d android?

房东的猫 提交于 2019-12-22 00:35:51
问题 According to the different-2 screen resolution, can't use a single image for every device. So, how to manage this thing in Cocos2d-android ? or Using setScale() is ok with it. 回答1: You have to create a method that can get the appropriate image according to screen size. There are following steps that will help you to get image 1) Get the screen size and store that in a variable I have used as WindowManager wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE); display = wm

Has anyone run their game on Higher Resolution in Cocos2d-android?

我们两清 提交于 2019-12-21 21:08:04
问题 CCScene doesn't show anything on higher resolution ? I am working on a project in which I'm using the cocos2d_android.jar and on the 4.3 version the screen goes blank and music/ccTouches/others things working fine. Even after I change the jar file with the API level 18(4.3 version), Add into my project and there is no error in the import time and uses their classes but in the RunTimeError occurred like : 09-14 07:49:49.890: E/AndroidRuntime(1282): FATAL EXCEPTION: GLThread 102 09-14 07:49:49

ANDROID:How to open web page in class extends CCLayer

时光总嘲笑我的痴心妄想 提交于 2019-12-20 06:36:56
问题 I am newbie in cocos2d game development and developed 50% game using of Cocos2d SDK Android.I am stuck when the user plays certain level of game more than 3 times then i have to redirect him to google play url to rate my app but not able to do this as i am not able to open the webpage as we did in a class extends activity.I searched every where but there is no such help found to help my cause. Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse("url")); startActivity(in); My class extends

How can I use CClistview in COCOS2d Android?

筅森魡賤 提交于 2019-12-19 10:25:54
问题 I am working on a cocos2d game. In this game, I have to display a score level-wise: ================================================== Level Score 1 500 2 600 3 900 I want to use the cclistview in my game. Does anyone have an idea about cclistview and how it's used in Android cocos2d? 回答1: I think you are confusing cocos2d for android and cocos2d-x as same sdk. I don't know of any cclistview in Cocos2d. There is one CCTableView in cocos2d. You can find its implementation in the cocos2d

Cocos vs AndEngine for android [closed]

谁说我不能喝 提交于 2019-12-18 05:56:07
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I want to make a game using Tiled Map Editor and I want to move the character around using a D-Pad for moving the character So I'm wondering which Engine would be better AndEngine or Cocos2d Keep in mind i'm a beginner at this so I'd like to stare at a lot of tutorials. :-D

Why am I getting an InvocationTargetException? Android 2D game

一世执手 提交于 2019-12-17 19:57:53
问题 I am making a 2D game in Android with Cocos2D, written in Java. Here is my code for the main stuff: public void gameLoop(float dt) { //Player Gravity if(canExecuteMovement(0, 6)) { guy.moveY(6); } //Player Movement if(direction == 1) { if(canExecuteMovement(-3, 0)) guy.moveX(-3); } else if(direction == 2) { if(canExecuteMovement(3, 0)) guy.moveX(3); } } private boolean canExecuteMovement(int xChange, int yChange) { int projectedX = guy.getBounds().left + xChange; int projectedY = guy

Android game development with Cocos2d lib

半世苍凉 提交于 2019-12-12 20:13:35
问题 I want to develop game development with Cocos2d . I am following the tutorial http://dan.clarke.name/2011/04/how-to-make-a-simple-android-game-with-cocos2d/ . I added external cocos2d-android.jar file but when i run sample apps then caused following error. please anyone help me. 04-18 13:09:50.783: E/AndroidRuntime(497): FATAL EXCEPTION: main 04-18 13:09:50.783: E/AndroidRuntime(497): java.lang.NoClassDefFoundError: org.cocos2d.opengl.CCGLSurfaceView 04-18 13:09:50.783: E/AndroidRuntime(497):

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

回眸只為那壹抹淺笑 提交于 2019-12-12 17:26:41
问题 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: "中国", text2:"中". local text1 = self.__editBox2:getText() local text2 = self.__editBox3:getText() local code1 = "" for i = 1, string.len(text1) do code1 = code1 .. "-" .. tostring(string.byte(text1, i)) end local code2 = "" for i = 1, string.len

Handling a Share Button Click on Android Game

我的未来我决定 提交于 2019-12-12 01:32:47
问题 Hi I want handle a click on Screen. The class does not extends an activity class so I cannot use any trivial method to handle the click. I know how to handle the click on android app but I am new to game development so I have limited knowledge about the Game. So My requirement is : There is a Share icon on Game over screen. I want to handle this icon click like when a user presses on this icon He will be shown a bunch of sharing option like facebook,Twitter, Skype and many more Using

How can i override ccTouchbegan in cocos2d-android( removal of overlaying sprites)

孤街醉人 提交于 2019-12-12 00:22:52
问题 I have a set of sprite lists.i want to remove the topmost lying sprite if the sprites overlap. if ( popRect1.containsPoint( popRect1, location ) ) { BaloonList1.remove( baloons ); baloons.removeSelf(); } if ( popRect2.containsPoint( popRect2, location ) ) { BaloonList2.remove( baloons ); baloons.removeSelf(); } When two sprites of same list overlap and if i touch them only the topmost sprite will be removed...if 2 sprites are from different list and when i touch the topmost sprite both of