Set sprite width or height without scaling it's children
- by Gabi Barrientos
I am trying to dynamically change the width and height of a Sprite object, which is a container for other similar Sprite objects. The container object automatically changes it's size according to the size of it's children, but when I change the position of the children objects, the size of the container stays the same and it's children appear to be placed outside of the container.
I tried to solve this problem by using something like this:
if (container.width < (child.x + child.width)) { container.width = (child.x + child.width); }
but when I use this code, the container object's children are scaled.
Is there a way to change the container's size without scaling it's children?