How do I add c2runtime with twig views

  • Hi,

    I'm adding to my views(twig from php) something like this:

    <script src="{{url_base}}/views/tour/juegos/DelfinAlFin/c2runtime.js"></script>

    It works on phaser, easel, pandajs, pixi and so on... I have to write it like that "everywhere", at pre/loading files like sprites, images and sounds. But always work.

    What I think c2runtime is trying to load something with relative path, like data.js(but i added the javascript variable of the path and fixed the error of image resources wrote below).

    But I can't do the same with a Construct2 game. It shows at the console:

    Project model unavailable

    ga c2runtime.js:5

    k.dj c2runtime.js:99

    k.jv.$e.h.onload c2runtime.js:83

    Uncaught TypeError: Cannot read property 'project' of null

    k.dj c2runtime.js:99

    k.jv.$e.h.onload c2runtime.js:83

    It showed some errors about failing to fetch the image resources, but i fixed it adding the twig views variables.

    More technical info:

    Line 5: ga=function(c){window.console&&window.console.error&&window.console.error(c)};

    Line 99: its something related to: this.Sf=new Image,this.Sf.src=

    url_base+"/views/tour/juegos/DelfinAlFin/loading-logo.png");

    I'm not showing other lines because it makes no sense, we can't understand it at all, but you can see in your c2runtime haha.

    Any help would be appreciated. Thanks!!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Solved but not fixed:

    I created a iframe.html with just the c2runtime and the canvas and in the view I wrote the iframe.

  • I had issues with data.js also, because it is not tied to the "/images" or "/resources" file directories in Construct. I had to put a copy of it on my webserver root, which means that it is open to manipulation by anyone who manages to hack our gateway Apache.

    Actually, I should try and produce a specific proxy for that file...

    I am going to assume that you have some manner of proxy setup which you do not have configured properly?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)