Hello.
I have an object.
I have an event that subtracts all of the object’s width except for one point.
I want it to subtract the width to the right, but it always goes to the left.
How can I change this?
Hello.
I have an object.
I have an event that subtracts all of the object’s width except for one point.
I want it to subtract the width to the right, but it always goes to the left.
How can I change this?
I’m having trouble making sense of this. Do you want to move the object to the right? Or take the width from the point to the right? Something else? Can you explain with a diagram at all?
When you want it to move left when subtracting width (same if you wand to add width)
You simply also need to subtract its X position at the same time
Objects are positioned based on the object’s origin. I’m assuming your objects origin is at the default 0,0
When the object’s width is adjusted it will appear to shrink/grow on the right side.
If you want the object to shrink/grow on the left side then you could change the object’s X position while adjusting its width.
Or you could move the X origin to the right side. Meaning if the object was 32 px wide then you could move the origin to 32. Then you would only need to adjust the width.
The object would then always grow/shrink towards the left.
add the distance u subract from the width to the x.
If it is always going down to 1px wide, you could do this cheap and dirty method:
Change X position to object.BoundingBoxRight()
Change width of object to 1