sprite_width

Returns the width of the currently assigned sprite.

Syntax:

sprite_width


Returns: Real


Description

This read only variable returns the width of the sprite that has been assigned to the instance. This width is returned in pixels and will be dependant on the image_xscale. If you need the un-scaled width you should use sprite_get_width.


Example:

if sprite_width != sprite_get_width(sprite_index)
   {
   image_xscale = 1;
   }

The above code checks the width of the sprite assigned to the instance running the code against the width of the sprite resource and if it is not the same, it resets the image_xscale to 1,


Back: Instance Properties
Next: sprite_xoffset
© Copyright YoYo Games Ltd. 2018 All Rights Reserved