Question Relating to Origins

Started by Nicholas, December 22, 2023, 12:52:40 AM

Previous topic - Next topic
Hi, I recently downloaded the version of Solarus with the Quest Editor because I wanted to create my own Zelda-like game someday.  When I figured out that I needed a DAT file and learned how to make one for my sprite sheets, I am confused about something.  When reading the DAT file for a chest, I noticed how a 16-pixel by 16-pixel chest has an origin_x of 8 (which is understandable since it's half the length of the chest), but I am so confused as to why the origin_y is 13.  Could someone knowledgeable explain this to me?

January 26, 2024, 08:56:39 AM #1 Last Edit: January 27, 2024, 02:19:41 AM by corinedye
Hello, as I know, the origin_x and origin_y values in the DAT file represent the coordinates of the origin point or pivot point of a sprite.

The origin point is the reference point around which the sprite is positioned and rotated. It is used to determine the position of the sprite in the game world and how it interacts with other game elements. uno online

Regarding the specific example of the chest sprite you mentioned, where the chest is 16 pixels by 16 pixels and has an origin_x of 8 and origin_y of 13, it's important to note that the origin point is not necessarily located at the center of the sprite.

The origin_x value of 8 means that the x-coordinate of the origin point is positioned at 8 pixels from the left edge of the sprite. This value of 8 corresponds to half the width of the sprite (16 pixels / 2 = 8 pixels), which aligns the origin point with the center of the sprite horizontally.

The origin_y value of 13 means that the y-coordinate of the origin point is positioned at 13 pixels from the top edge of the sprite. The specific value of 13 for the chest sprite is determined based on the visual design and alignment of the sprite graphics. It may be offset to accurately represent the positioning of the chest's lid or other visual details.

Ah, I see!  Thanks so much for explaining.  This was my first time reading a DAT file, as well as learning of its existence, and was unsure of why it was positioned there.  I was under the assumption that the origin point would usually be positioned in the center of a sprite instead of representing the lid or other visual details - like you mentioned.