How can I set the reference point to make the image WIDTH change towards LEFT ONLY?

Dear all,

I am making a hp bar.

Generally the problem is: when the image change its shape, it change towards the center.

I have seen some tutorial before that decrease the hp bar by changing its width and move the x of it. (so it appears like the bar has decreased towards left.

But when I want to make the hp bar decrease gradually by transition.to, the problem appears.

Yes! ppl can see the hp bar has been moved as it decrease gradually @@

so I want to ask if there is any way to set the reference point of the image that make it change it width towards left, but not the center.

image:setReferencePoint(display.CenterLeftReferencePoint) does not work.

Thanks!

The way corona handles the reference points is generally problematic, so many people just updated the x coordinates when object sizes change.

One thing you could do for your particular situation is-- in the transition.to() you can set multiple variables to change, so you could also include a change to the x coordinate at the same time you are changing the rectangles width. ie; transition.to(hpRect, width = life/10, x = 100-life/10, etc, etc)

The way corona handles the reference points is generally problematic, so many people just updated the x coordinates when object sizes change.

One thing you could do for your particular situation is-- in the transition.to() you can set multiple variables to change, so you could also include a change to the x coordinate at the same time you are changing the rectangles width. ie; transition.to(hpRect, width = life/10, x = 100-life/10, etc, etc)