image_xscale (Game Maker)

edit this page

( Game Maker 6.1, 7 )

image_xscale - horizontal scaling of a sprite.


image_xscale is a local variable that contains the horizontal scaling of a sprite. It is by default 1, which means the sprite is scaled to 100% (its normal size). A value lower than 1 will decrease the size of the sprite and a value higher than 1 will increase it.

image_xscale only scales the sprite horizontally (makes it wider). If you want to scale a sprite equally, you must use image_xscale in conjunction with image_yscale


Example of Use

image_xscale = 2;

This will make a sprite twice as wide.

Keeping Aspect Ratio

To keep the aspect ratio of a sprite, you must use image_xscale with image_yscale.

image_xscale = 0.5;
image_yscale = 0.5;

This will make a sprite half its normal size.

Related pages

Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.