I was experimenting last night and one experiment involved changing the height of a sprite. This did not have the desired outcome and instead of the sprite being scaled vertically the mask was scaled and the underlying image was not.
I this going to be default behaviour? [import]uid: 5354 topic_id: 1725 reply_id: 301725[/import]
Sounds like a bug, but I’m looking at scaled (and rotated) sprites right this second and it looks fine. What’s the code? [import]uid: 54 topic_id: 1725 reply_id: 5074[/import]
This is now fixed. Setting width/height won’t affect the sprite’s width/height, use xScale/yScale instead. [import]uid: 54 topic_id: 1725 reply_id: 6490[/import]
Well I might want to set an object to a specific height, for whatever reason. I just might want to say be 50px high rather than be 25% high to get the same effect
If the layout is in pixels then it just seems natural [import]uid: 5354 topic_id: 1725 reply_id: 6550[/import]
You can set the height to 50 pixels using for example
sprite.yScale = 50 / sprite.height
I can see there might be a slight issue with exact math, and rounding, and it is a little bit less straightforward.
One issue that occurs to me is, what do we do if the sprite changes its height? You might ask, how can that happen, but that would be telling
[import]uid: 54 topic_id: 1725 reply_id: 6551[/import]