How do I add c2runtime with twig views

Get help using Construct 2

Post » Mon May 04, 2015 6:40 pm

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!! :)
B
4
Posts: 3
Reputation: 221

Post » Tue May 12, 2015 5:18 pm

Solved but not fixed:

I created a iframe.html with just the c2runtime and the canvas and in the view I wrote the iframe.
B
4
Posts: 3
Reputation: 221

Post » Fri May 15, 2015 6:36 pm

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?
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,414
Reputation: 4,822


Return to How do I....?

Who is online

Users browsing this forum: YoHoho and 9 guests