-
Notifications
You must be signed in to change notification settings - Fork 40
Sprites and Sprite Atlas Files
You may notice that many of the game images use sprite sheets with an accompanying (.atlas) file. The atlas is a text document that specifies where the sprites can be found on the atlas. For the sake of not using copyrighted assets, we can look at the current "editorIcons4x.png" and "editorIcons4x.atlas" files.
The editor icons used to look like this (note it has been cropped to better fit the window):
But I have remade them to look a bit nicer and even added a few new icons for some new game objects that I created. Since the original creator upscaled them, may as well take advantage of that extra pixel density.
Opening up the atlas file gives us this:
1
4
editor 2d mode:176,0,16,16,0,0
editor bed:87,2,8,11,0,0
editor color shift:144,0,16,16,0,0
editor compass sound:16,16,16,16,0,0
editor dialog box:112,2,9,11,0,0
editor door:32,16,16,16,0,0
editor dungeon:128,0,16,16,0,0
editor dungeon blacker:192,0,16,16,0,0
editor egg teleport:32,0,16,16,0,0
editor enemy trigger:160,0,16,16,0,0
editor floor:16,0,16,16,0,0
editor grave trigger:160,16,16,16,0,0
editor hit trigger:208,0,16,16,0,0
editor intro:104,3,7,9,0,0
editor item disabler:96,0,16,16,0,0
editor jump:48,0,16,16,0,0
editor key condition setter:144,16,16,16,0,0
editor key setter:128,16,16,16,0,0
editor kill trigger:160,16,16,16,0,0
editor ladder:80,16,16,16,0,0
editor ladder top:96,16,16,16,0,0
editor light:112,16,16,16,0,0
editor music:0,16,16,16,0,0
editor object hider:208,16,16,16,0,0
editor object respawner:224,0,16,16,0,0
editor object spawner:64,0,16,16,0,0
editor overworld:0,0,16,16,0,0
editor position dialog:64,0,16,16,0,0
editor room darkener:176,16,16,16,0,0
editor script on touch:80,0,16,16,0,0
editor shadow disabler:112,0,16,16,0,0
editor shadow setter:80,5,7,7,0,0
editor shore sound:16,16,16,16,0,0
editor slow:64,16,16,16,0,0
editor teleporter:32,0,16,16,0,0
editor upper level:192,16,16,16,0,0
editor water:48,16,16,16,0,0
Let's look at what each line does one by one.
- Line 1: The very first number is irrelevant. It refers to the "version" which is not currently used.
- Line 2: The second number is extremely important. This is the "scaling value" of the PNG, which is multiplied by the offsets/dimensions.
- Line 3+: Everything after is the list of sprite entries and where they can be found on the sprite sheet.
Think of the six numbers in a sprite entries as "pairs", meaning 3 pairs of 2 numbers for a total of 6 values.
Now let's break down an entry: editor 2d mode:176,0,16,16,0,0
- editor 2d mode: This is the name of the sprite. This must not be changed or the game will not know what it is.
- 176,0: This is the first numerical pair, and is the X and Y values of top left corner of the entry.
- 16,16: The second numerical pair is the size of the image. In this case, 16x16 pixels from the top left corner.
- 0,0: This the "origin" offset, and determines the sprite's placement on the editor sprite selection window when holding control.
Remember that the scaling value is the value found on the second line. Now that everything has been explained, there is another reason I chose the editor icon sheet. And that is because I do believe it is the only sprite sheet that uses a scale other than 1x.
The values on a sprite entry assume a 1x scale. When a scaling value above 1x is used, both the offset and resolution of the entry are multiplied by the scaling value. This is where the sprite will really be found on the PNG image if it's scaled up from it's 1x size.
That means that this example:
editor 2d mode:176,0,16,16,0,0
Really means this:
editor 2d mode:704,0,64,64,0,0
Because this is what is happening:
- 176 x 4 = 704
- 0 x 4 = 0
- 16 x 4 = 64
- 16 x 4 = 64
The final two remaining 0's I'm not 100% certain of at the moment. I believe these values are only used for editor purposes when holding the Control key which displays the sprite placement window, and I don't know if they are multiplied by the scaling factor. There is not a lot of sprites that use these values, but they do exist. When I figure out how they work, I will update this wiki entry.
And that's all there really is to it when it comes to sprite sheets and sprite atlas files.
- π‘ Home
- π€ Building & Contributing
- π Additional Info
- π Main Update Loop
- π§ Direction
- π₯οΈ Dialog Path Loader
- πΊοΈ Dungeon Minimap Files
- πΌοΈ Sprite Atlas Files
- π₯ Camera Field Objects
- π·οΈ Placeholder Tags
- πΌ Music Indexes
- π£ Launcher Mod Maker
- π§© Texture Replacement
- πΌοΈ Custom Menu Border
- π΅ Music Replacement
- πΆ Sound Effect Replacement
- πΊοΈ MapOverlay Custom Info
- π Dialog Replacement
- π LAHDMods