How do I change object properties in javascript?


I am trying to change the width of a panel sprite with the Platform behavior like this:

var o = runtimeScene.getObjects(one);
o[0]["_width"] = 100;

This make the player character glitch out while walking over it but it doesn’t change the width of the object.

I assume that I also need to change the aabb:max values to fix the player interaction, however I am unsure how to access them.

Is the way it is drawn dependent on the aabb variable to or do I need to manipulate a third Variable?

I am really a bit stuck here, any help is greatly appreciated.

For the position we can just use “o[0].setY()” but an equivalent for size does not seem to exist.


Java or Javascript? :thinking:


When you want to dod something with the behavior you need to get the behavior (object.getBehavior("BehaviorName")[...])


Changing the behaviour’s width only changes a variable called ‘_oldWidth’ and the ‘width’ of the panel sprite (the owner object of the behaviour). It looks like the behaviour itselfe doesn’t have a width variable.