Api integration

Discussion and feedback on Construct 2

Post » Tue Apr 01, 2014 2:05 am

I am wondering if i can insert code directly into the index or js file while exporting as html5 in c2.
For instance this stuff https://developers.google.com/mobile-ad ... tals?hl=fr
B
12
S
4
G
1
Posts: 241
Reputation: 1,699

Post » Tue Apr 01, 2014 3:20 am

I'm not a seasoned coder, but it would see to be possible. if you can get the code into the c2runtime.js file and not break the existing logic.

i think squeezing something like an api call in would be doable... what i think would get hairy is trying to manipulate game logic and actions with code.

Also keep in mind that you might also want to look into making a plugin. plugins are basically just snippets of javascript. plug in your custom code and access it from C2.
B
59
S
9
G
1
Posts: 939
Reputation: 6,545

Post » Fri Apr 04, 2014 4:25 am

@vagaev

You can make a script tag in the index.html and place a function in that after exporting if the code is in html. Then you can call the function using browser execute javascript action. api calls are also doable if you make an external js file then do a call to it. But I'm not sure what programming language it is and I'm too lazy to find out. It might be best to find out which language it is first.
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Fri Apr 04, 2014 4:26 am

Wait never-mind, I think its java. If so, then you won't be able to use it.
B
18
S
4
G
3
Posts: 436
Reputation: 4,801

Post » Fri Apr 04, 2014 11:11 am

If you want to add custom code to Construct 2, don't edit c2runtime.js after export! Use the Javascript SDK instead: https://www.scirra.com/manual/15/sdk

Note the page you linked to is about a Java library, and Java is different to Javascript so you can't use it in C2.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762


Return to Construct 2 General

Who is online

Users browsing this forum: lukewasthefish and 9 guests