Game Development Reference
In-Depth Information
Getting the offset of a sprite
The
sprite_xoffset
and
sprite_yoffset
variables return the
x
and
y
offset of a
sprite. Offset is another word for the origin of a sprite. For example, if the origin of a sprite
that is 32 pixels wide is centered, the
x
offset will be 16 as that is half of 32.
The following is the example code:
var sxoff=sprite_xoffset;
var syoff=sprite_yoffset;