Game Development Reference
In-Depth Information
Sprite origins
We will start with the most used option of any sprite, the origin.
The sprite origin defines the center point of a sprite. The origin is made up of two values,
the X axis and the Y axis. The X and Y axes allow us to define the center point of a sprite
on a 2D plane. A common place for a sprite origin is the middle of a circle, or the top left
of a button.
The origin is represented by a gray cross on the image.
Sprite origin can be very useful when it comes to positioning and rotation. When placing an
object in a room, the object locks to the grid based on the sprite origin attached to it. If the
origin is in the middle of the object, then the object will look to the middle on the grid.
When rotating a sprite, the origin is used as the pivot point. When creating something like a
turret, you will put the origin on the place where you want the turret to rotate.
To change the origin of a sprite, double-click on the desired sprite to show its properties
window. On the window, you will see a section labeled Origin .
Within the regions of this section, there are two boxes labeled X and Y . These show the X
and Y positions of the sprite's origin. You can change these values to change the origin of
the sprite. You can also click on Center to have GameMaker automatically find the center
point of the sprite.
You may also change the sprite's origin by clicking and dragging anywhere on the sprite's
preview image.
Search WWH ::




Custom Search