Tileset Support: Difference between revisions
No edit summary |
No edit summary |
||
Line 31: | Line 31: | ||
By modifying gfx/tinytile.png and gfx/tile_config.json, you should now be able to roll your very own tilesets. Enjoy! | By modifying gfx/tinytile.png and gfx/tile_config.json, you should now be able to roll your very own tilesets. Enjoy! | ||
{{Guides}} | |||
[[category:technical]] | [[category:technical]] |
Revision as of 15:37, 7 December 2013
Tileset support is currently a work in progress, but complete enough to start creating tilesets.
The tileset is contained in the gfx/ directory. All sprites are contained in a single file, currently "gfx/tinytile.png". Since many sprites are contained in the same file, sprites must be identified by their position within the file. The position is specified as an index, that increases first from left to right, then from top to bottom. For example, the top-left sprite is at index "0", then the sprite right of that is at index "1" and so on.
http://i.imgur.com/nEm57Iq.png
In the above example, the human sprite would be specified with the index "32". This index can then be used to associate the sprite with an entity in the game. This is done in gfx/tile_config.json. For example, in that file the sprite for the male player entity is defined as follows:
{
"id":"player_male",
"fg":32,
"rotates":false
},
Here, the id property refers to the entity that we're specifying. "fg" refers to the "foreground" sprite. You can create composite sprites by specifying both "fg" and "bg", for instance the "fg" being the bush, the "bg" being grass or something else the bush might be placed on.
Another important property in gfx/tile_config.json is the width and height of each sprite. This enables you to make tilesets with smaller or larger tiles.
"tile_info":
[
{
"height": 16,
"width": 16
}
]
By modifying gfx/tinytile.png and gfx/tile_config.json, you should now be able to roll your very own tilesets. Enjoy!
|