Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Game development stories & opinions
I'm making a plugin and in the edittime.js i'm using AddObjectParam to add a object to my action. Then in runtime.js in the action function i would like to be get the object width and height. I could only fine the following method as a reference.
var inst = this.runtime.createInstance(obj, layer,parseInt(temp),parseInt(temp));
var width = inst.width;
var height = inst.height;
I would like to not have to create a instance of the object to just get the width and height.
All instances have width and height properties - why not just access the ones from the object type given to you in the parameter?
var width = obj.width;
var height = obj.height;
and i got a assertion failure. I think i'm still not doing something wrong.
I just figured it out.
var width = obj.instances.width;
var height = obj.instances.height;
Develop games in your browser. Powerful, performant & highly capable.
AddObjectParam is to get the "type", not an instance. See the structure of "type" in firebug for more detail.