Questions tagged [cocos2d-js]

Cocos2D-JS is a package that includes the JavaScript Bindings (a.k.a. JSB) needed for compiling Cocos2d-html5 code to native apps.

Cocos2D-JS is a package that includes the JavaScript Bindings (a.k.a. JSB) needed for compiling code to native apps for Android, iOS and other platforms. GitHub repository: Cocos2d-JS

Books:

368 questions
7
votes
2 answers

A problem occurred configuring project ':game'. > java.lang.NullPointerException (no error message)

I'm building apk from an android project exported from Cocos Creator V2.4.3 but getting the below error with Gradle A problem occurred configuring project ':game'. > java.lang.NullPointerException (no error message) I've deleted all android SDK,…
vantrung -cuncon
  • 10,207
  • 5
  • 47
  • 62
6
votes
2 answers

Admob Ads app crashes occasionally on IllegalArgumentException

I try to integrate AdMob ads and GooglePlay IAP into clean (hello world) cocos2d-js 3.5 project. Occasionally (every 5th run) the application crashes and shows the exception bellow. This behavior started when I've integrated IAP. Clean AdMob…
5
votes
2 answers

Reduce game size in Cocos Creator cocos2d-x

I am developing a game using Cocos Creator for Android and iOS platforms. The game is small in scale and has few graphics elements. I found that the APK and IPA file size for this game is 11.5 MB. I think these files (APK or IPA) must be containing…
5
votes
0 answers

Cocos2d js text alignment in Chrome and Firefox

This is how it looks in chrome and mozilla I am using cocos2dx-3.10 I have used this code var TestLayer = cc.LayerColor.extend({ ctor: function () { this._super(cc.color(255, 255, 255)); var lineUp = new cc.DrawNode(); …
5
votes
2 answers

Cocos2d-js: How to use a custom ttf font on android devices?

I use following code to display a custom ttf font: ml.score = cc.LabelTTF.create(ml.totalPoints.toString(), "fonts/American Typewriter.ttf",…
Michael
  • 6,823
  • 11
  • 54
  • 84
4
votes
0 answers

Identifying the cause of WebGL crashes on IoS/Android devices

I’ve been developing a game which uses WebGL for rendering, and while on PC I get no crashes, on Android/IoS devices I get random crashes during gameplay. I don’t see any particular areas that would cause crashes, however it still does. Considering…
Nobu
  • 41
  • 1
4
votes
1 answer

How to get Document Folder in ios device from a Javascript

I am integrating a cocos2d-js game into a native iOS app. At some point I have a Javascript function inside my ios native app with the following code: var txt = jsb.fileUtils.getStringFromFile("project.json"); But my project.json is in Document…
4
votes
1 answer

cc.ScrolView undefined in cocos2d-js

I tried to use ScrollView, TableView from cocos2d-js extensions and I noticed that it can't be seen! I also tried to create a class from that example but i need to use from native class!
Ghita Tomoiaga
  • 264
  • 1
  • 9
4
votes
1 answer

How to save a variable to Android using Cocos2D-JS?

I am trying to save a high score integer to the user's Android system, so that it can persist throughout all game-play experience. I have read that using Cocos2D-X one can use NSUserDefaults but this doesn't seem to be available in the Cocos2D-JS…
magicode118
  • 1,444
  • 2
  • 17
  • 26
4
votes
1 answer

How to display labels with custom ttf?

Apparently is is possible to use Cocos2d-js 3.0 RC3 cc.LabelTTF with custom fonts, for example as answered here. However this doesn't seem to produce any results for me, neither in the local JSBinding app nor in the web browser. Font file was…
Appleshell
  • 7,088
  • 6
  • 47
  • 96
4
votes
1 answer

How can I use native 3rd party libraries with Cocos2D-JS?

I am evaluating to switch from CoronaSDK to Cocos2D for cross platform development. The main requirement is that I need to be able to include native libraries for iOS and Android. I have come across How To Integrate a 3rd party SDK into Plugin-X,…
thomers
  • 2,603
  • 4
  • 29
  • 50
4
votes
1 answer

Can an embedded cocos2d-js app call back out to c++?

I'm researching the possibility of using cocos2d-js by embedding it as a view inside an existing iOS app. In order to make this work, I'm going to need 2-way communication between cocos2d and the surrounding application. After some initial…
Derek Thurn
  • 14,953
  • 9
  • 42
  • 64
4
votes
4 answers

Cocos2D-JS -- Compile and Run a 'Clean' build?

Context: I'm creating a Cocos2d-JS Game. I have already created the Project and am in development phase. I can run cocos run -p web or cocos run -p web --source-map from the project directory in the Console. These commands work and allow me to run…
Jono Tho'ra
  • 1,476
  • 3
  • 18
  • 28
3
votes
0 answers

cocos2d JS WebGL rendering is not working in iOS 14 public beta

I have some javascript games running on WKWebView with Cocos2d-x 3.17.2 and it has stopped being visible on devices with iOS 14 public beta. The clicks can be heard when touched but nothing is drawn on screen. On further testing it was found that…
glo
  • 1,408
  • 3
  • 25
  • 54
3
votes
3 answers

How to navigate between scenes Cocos creator?

I'm working with cocos creator v 1.3.1 I want to know how to navigate between scenes, Let say we have to scenes SceneA and SceneB. First game load SceneA after that I can load second scene by calling this function…
Jack001
  • 43
  • 1
  • 5
1
2 3
24 25