sprite_yoffset

Returns the y component of the sprite origin.

Syntax:

sprite_yoffset


Returns: Real


Description

This read only variable returns the local yoffset (the y component of the origin as defined in the sprite editor) of the sprite that has been assigned to the instance. This yoffset is returned in pixels and will be dependant on the image_yscale, so that (for example) if a square 32x32 sprite is defined as having the y origin at 16, when that sprite is scaled by 2 this variable will return 32. If you need the un-scaled yoffset you should use sprite_get_yoffset.


Example:

if y - sprite_yoffset < 0
   {
   y = sprite_yoffset;
   }

The above code checks to see if the top edge of the sprite of the instance is outside the room and if it is it moves the instance so that the whole sprite is visible.


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