{"id":805,"date":"2017-11-27T19:41:23","date_gmt":"2017-11-27T18:41:23","guid":{"rendered":"http:\/\/www.pixnbgames.com\/blog\/?p=805"},"modified":"2017-11-27T19:41:23","modified_gmt":"2017-11-27T18:41:23","slug":"how-to-use-libgdx-tiled-creating-the-tileset","status":"publish","type":"post","link":"https:\/\/www.pixnbgames.com\/blog\/libgdx\/how-to-use-libgdx-tiled-creating-the-tileset\/","title":{"rendered":"How to use libGDX + Tiled: creating the Tileset"},"content":{"rendered":"<p>In <a href=\"http:\/\/www.pixnbgames.com\/blog\/libgdx\/how-to-use-libgdx-tiled-introduction\/\">the previous article<\/a>, we saw that the tileset is the image that contains the tiles. Now we will see some simple tips to keep in mind at creating our tileset.<\/p>\n<h4>Dimensions<\/h4>\n<p>The first thing is to decide the dimensions of each tile: 16&#215;16, 32&#215;32, 48&#215;48, &#8230; Really, this is very subjective and it depends on each game, personal preferences and desired results. We are not limited to use same length for width and height; we can use, for example, tiles of 128&#215;64 pixels.<\/p>\n<p>An aspect to consider on this point is the screen resolution which our game is designed for. For example, if we go to project our game in a resolution of 320&#215;240 pixels, we can use tiles of 16&#215;16 pixels, whereas if our game is designed for a 1280&#215;720 screen, maybe we must use bigger tiles, for example of 64&#215;64 or 128&#215;128 pixels.<\/p>\n<h4>Graphics editor<\/h4>\n<p>It&#8217;s possible to use any graphics editor program which we are comfortable. In my case, I usually use <a href=\"https:\/\/www.aseprite.org\/\" target=\"_blank\" rel=\"noopener\">Aseprite<\/a> and <a href=\"https:\/\/www.gimp.org\/\" target=\"_blank\" rel=\"noopener\">GIMP<\/a> for pixel art, although there are many apps on the market, both payed and free. Some of them are designed exclusively for pixel art, like <em>Aseprite<\/em> or <em>Piskel<\/em>, and others ones are more generic like <em>GIMP<\/em> or <em>Krita<\/em>.<\/p>\n<p>One of the thing I consider that helps a lot is the possibility of showing a grid. This is a basic functionality supported by the most editors.<\/p>\n<h4>Color palette<\/h4>\n<p>I have not much to say here because I have not knowledge about graphic art. I simply comment it because a good choice on out color palette will give a consistent aspect to our games and it will look much better.<\/p>\n<p>&nbsp;<\/p>\n<h3>Tileset with Aseprite<\/h3>\n<p>From the time I discovered this tool, I have been using it more and more in my projects. In my last game, <a href=\"http:\/\/www.pixnbgames.com\/rainbowd.html\" target=\"_blank\" rel=\"noopener\">Rainbow Diamonds<\/a>, the most have been drawn with <a href=\"https:\/\/www.aseprite.org\/\" target=\"_blank\" rel=\"noopener\"><em>Aseprite<\/em><\/a>. The app have a good and intuitive user interface that allows to work easily.<\/p>\n<p>For this example, I will use an image of 128&#215;128 pixels with tiles of 16&#215;16 pixels, so I can have until 64 tiles. The first thing I do to work with tiles, is setting the grid in order to use them as guide for each tile. We can do that on the options <em>View<\/em> &gt; <em>Grid<\/em> &gt; <em>Grid Settings<\/em>. We set the width and height of each tile, in this case both are 16 pixels, and press <em>OK<\/em>. Now is the 16&#215;16 grid is showed.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-729\" src=\"http:\/\/www.pixnbgames.com\/blog\/wp-content\/uploads\/2017\/11\/configurar_grid.gif\" alt=\"\" width=\"520\" \/><\/p>\n<p>Using the drawing tools, we create the tiles we need. For this example, as you can see on the below image, I have drawn tiles for ground, water, a bush and a house.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-731 size-full aligncenter\" src=\"http:\/\/www.pixnbgames.com\/blog\/wp-content\/uploads\/2017\/11\/tileset.png\" alt=\"\" width=\"128\" height=\"128\" \/> As we can see, the bush and the house occupies more than a tile. This is not a problem, because what we will made, is to put them togheter at the time of design our scene, so each element will be drawn correctly. What matters is that a single tiled does not contains parts of different elements.<\/p>\n<p>To finish, we export the file to an archive named <strong><em>tileset.png<\/em><\/strong>.<\/p>\n<p>On the next tutorial, we will design the scene using the tileset created in this tutorial.<\/p>\n<p>Regards,<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the previous article, we saw that the tileset is the image that contains the tiles. Now we will see some simple tips to keep in mind at creating our tileset. Dimensions The first thing is to decide the dimensions <a class=\"more-link\" href=\"https:\/\/www.pixnbgames.com\/blog\/libgdx\/how-to-use-libgdx-tiled-creating-the-tileset\/\">Seguir leyendo <span class=\"screen-reader-text\">  How to use libGDX + Tiled: creating the Tileset<\/span><span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":736,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[56,15,55],"language":[4],"_links":{"self":[{"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/posts\/805"}],"collection":[{"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/comments?post=805"}],"version-history":[{"count":2,"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/posts\/805\/revisions"}],"predecessor-version":[{"id":809,"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/posts\/805\/revisions\/809"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/media\/736"}],"wp:attachment":[{"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/media?parent=805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/categories?post=805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/tags?post=805"},{"taxonomy":"language","embeddable":true,"href":"https:\/\/www.pixnbgames.com\/blog\/wp-json\/wp\/v2\/language?post=805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}