I'm trying to use Cocos2d-html in a Django app.
From a HTML file, I need to refer to cocos2d.js, and from cocos2d.js I need to refer to another Javascript files.
Cocos2d.js is located in the [static folder]/js/ The other .js files that I need to refer from cocos2d.js are located in [static folder]/js/Platform and [static folder]/js/Src.
This is how I'm referring to cocos2d.js from the HTML file:
<script src={% static "js/cocos2d.js" %} ></script>
This is how I'm referring to the files from cocos2d.js
engineDir:'./Platform/HTML5/cocos2d/',
appFiles:[
'./Src/resource.js',
'/Src/MainLayer.js',
'./Src/GameOver.js',
'./Src/main.js'
But when I run the html file, the game doesn't show up. How can I refer properly to these files inside the Django environment?
I also tried to create a global var with StaticDir in js like this:
window.STATIC_URL = '{{STATIC_URL}}';
And then concatenate the values:
engineDir: STATIC_URL + 'js/Platform/HTML5/cocos2d/',
But, them I get this error in Chrome console
Uncaught SyntaxError: Unexpected token < :8000/herorush/%7B%7BSTATIC_URL%7D%7Djs/Platform/HTML5/cocos2d/platform/jsloader.js:2