Godot version: 2.1.3 and 2.1.4
OS: Windows 8.1 Enterprise
CPU: Core i5 vPro
RAM: 8 Gb
As I said in this LINK post (19036) :
I am trying to execute javascrip code from my Godot project exported to html5, in order to make HTTP requests and obtain information through the publishers API. In this case, I am trying to achieve this with the Kongregate API.
This LINK part of the documentacion explain how to do some of that so I tried to make a simple Godot html5 project with only this script:
var JavaScript
func _ready():
# retrieve the singleton here, will return `null` on platforms other than web
JavaScript = Globals.get_singleton("kongregate_api")
my_func()
pass
func my_func():
# call JavaScript.eval only if available
var label = get_node("Label")
if JavaScript:
JavaScript.eval("alert('Calling JavaScript per GDScript!');")
label.set_text("Calling JavaScript per GDScript!")
else:
label.set_text("Existe? " + str(JavaScript))
The project only have a Node2D as a parent and a Label as child.
I uploaded this project to Kongregate and Gamejolt. So far, I tested the Kongregate version and printed only:
Existe? [Object:null]
I think Kongregate sends the kongregate_api.js to each game, so it should be available to find it... but I've failed ... T.T.
- Where is JavaSingleton hiding?
- What exactly is JavaSingleton?
- Can anyone tell me how to simply access a simple .js file within the
Godot project? a functional example. please?