![]() If you've just got a set of fixed assets, like the set you purchased, you may want to just go through the unpack/rename/re-pack process I mention in my first method above. Then I refer to the assets by tile coordinates, rather than pixel offsets and sizes.Įven though libGDX provides these helpful tools (packed spritesheets / texture atlases / etc.), in my limited experience, I've found I like my way better. This method works particularly well in my current project, which is a 32x32 tileset game, where I just keep my art assets in grids in. As long as my artist doesn't move things around, they are free to make tweaks, without having to modify the XML asset file for the level. Then I have another XML node-type for animations, which allows me to specify individual frames from one or more spritesheets. This sounds tedious, but once you standardize your artwork, it's very painless. ![]() I implemented a custom asset manager class that takes XML files wherein I provide the spritesheets, referenced by a name, then provide named textures or sprites which take the spritesheet name, then an offset and size into that spritesheet to get the individual sprites. The second method, and the one I'm using on my current work, is to manage my assets myself for each level, via an XML file that I load at level-load-time. I can't find the one I used initially, but here's another one that's actually a bit more flexible: Alferd Spritesheet Unpacker The unpacker then extracts the individual files into a directory, which you can then re-pack using libGDX-aware utility, to take the directory of individual files (which you should rename before this, so the atlas you get back will have useful aliases) and re-build them into a single spritesheet with accompanying atlas (pack file). The first was to use a spritesheet unpacker, which basically allows you to provide parameters for padding round the margins, the size of the tiles/sprites, then the horizontal and vertical padding between the sprites. I have solved this problem two different ways. I had the same issue, trying to use resources from. ![]() I'm sure most users of libGDX will encounter this as soon as they try to use spritesheets from other sources (not made in-house, with libGDX in mind). So when cutting up the tiles for my tileset "shadow_light", I would start them from index 2048, one less than the gid, EX: "shadow_light_2048.png".I would also be interested in hearing how other people manage their artwork in libGDX. This should be denoted at the top of the. ![]() For example, my second tilesheet starts from 2049, as their are 2048 tiles in the first sheet. For example: shrine_tilesetįinally (and this is the part I could not figure out), make sure each tileset's tile indexes start from the "firstgid" value in the. If it works correctly you will see the name of each tileset in the atlas file with an associated index based on the tile id. Second, re-pack all tiles from all tilesets into a single atlas in TexturePacker. You can do this with the crop command in ImageMagick like so:Ĭonvert.exe "shrine_tileset.png" -crop 16x16 "shrine_tileset_%02d.png" First, cut up the tileset images using a utility like ImageMagick and make sure they are indexed (specified by an underscore and number in the filename). Here is how to properly do it when working with multiple tilesets and re-packing your spritesheets in TexturePacker. tmx files are read I was able to fix my problem. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |