Hello,
I have a function that creates an object
createObject(runtime.objects.Player) createObject(object) { const instance = object.createInstance( this.ABOVE_LAYER, this.W, this.H ); const { Bullet } = instance.behaviors; Bullet.speed = 100 Bullet.isEnabled = true; // todo, change the instance width. }
I would like to change the width of newly created instance., Looks like there is no `width` setter on the instance itself.
Any ideas?
You create the instance then assign the width and height to it.
const obj = runtime.objects.Player.createInstance(layerNameOrIndex, x, y);
obj.width = 10;
obj.height = 10;
https://www.construct.net/en/make-games/manuals/construct-3/scripting/scripting-reference/object-interfaces/iworldinstance
I've tried that, but changes don't seem to reflect. weird
Develop games in your browser. Powerful, performant & highly capable.
Looks like it doesn't work if inside a Family.