I'm trying to include a new js file containing a new scene on a cocos2d js project, but every time try occurs the following error:

Uncaught ReferenceError: GameScene is not defined.

I included my file in jsList and in appList:

"jsList"        : ["src/game_scene.js"],
    "appFiles"      : ["src/game_scene.js"]

The code of my scene looks normal:

var GameScene = cc.Scene.extend({

        var gameLayer = new GameLayer();

The code on app.js to call my scene looks good too:

var gameScene = new GameScene();

What should I do?


I solved the problem. I included the file in "jsList" of "project.json".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.