Anyone have any success getting those referenced in the JS? The "const" thingy used in the announcement blog posts just gives an error whenever I try to preview the game.
Develop games in your browser. Powerful, performant & highly capable.
Not sure if you've found it yet but the scripting documentation tells you how to do this.
You can get a reference to the object class with
const Sprite = runtime.objects.Sprite; // Sprite object class
const first = Sprite.getFirstInstance(); // first instance of Sprite
const instances = Sprite.getAllInstances(); // all instances of Sprite
Not all types have full interfaces yet, the ones that so are listed under the "Plugin interfaces" section in the documentation menu. However, there are a set of common methods for object classes and instances that exist for doing things like creating new instances, destroying old ones and moving them around the layout.
Thank you so much for the reply!
The documentation was just what I needed. Couldn't find it by myself. Global variables work already, which is nice :)
Glad to hear. Have fun and let us know if you have any feedback. Bear in mind that both the feature and documentation are still beta at the moment.