5/1/2023 0 Comments Texturepacker stretching png![]() I have created a basic example on how to load a sprite sheet and address it in order to animate a game character with it. I will get to that tomorrow, it`s pretty late already. TP is also able to output the original frame size of the single images, allowing pixel-perfect size the sprite later on and offsetting it from the original size, so the animation boundaries don`t cause the sprite to jerk around whilst being animated. XPos=X Position of the sprite on the sheet Image Name=the original filename (useful for later reference) Some, for our purposes, more ore less useless header stuff ![]() After trimming and all that stuff, TP has to generate a power-of-two image out of all of your sprites, and a Generic XML. A folder containing your sprites with a proper enumeration in the filename (e.g. Unfortunately, Construct Classic doesn`t come with a routine for spritesheets, but what I did is that I used the general XML export of TexturePacker and wrote my own.īasically, TP does all the dirty work, you just have to provide the following:ġ. It also exports to various formats of Game Development frameworks. The trial does offer the ability to split sprite sheets, but that an also be done elsewhere, even online. No blatant advertising intended, but I found TexturePacker () to be the perfect tool to create Spritesheets. Open TexturePacker, it may ask you to enable a trial, or just use the free version, its up to you if you want to use the trial. Since we cannot use Construct`s built-in cycling through image banks, we must use our own routine to find the correct sprites on the sheet, animate them, and so on. There are tools to create ninepatches but if you make a atlas with the texturepacker in Gdx.tools you can add a split parameter. It comes at some cost, though, namely CPU time. The trick with the NinePatch is that you can make the button very small and set the stretching area so it will scale to the size you need. In that example it would be a saving of around 2 MBs of V-RAM, that`s something like. With the proper technique, you can squeeze all 50 frames of 70x70s or whatever on one single 512x512 image, let`s say with 1 pixel margin and address them through construct. Things can add up quickly if you have more of those characters at hand. ![]() Construct will reserve 3,2 MB of VRAM (128x128 for the next power of two size * 4 byte * 50 frames) at just to display this single character. The character sprite is most of the time around 70-80p in both width and height, that�s already a sh*t if you have let`s say 50 frames in total. Let`s say, you use the ordinary sprite for animation of your game`s main character. On top of that, proper usage can save a whoppin' amount of V-RAM. It is really flexible, especially if you want to charge up new gfx at runtime. I`ve been tinkering around with spritesheets lately and it comes down to the fact that Tiled Background really is an alternative if you need dynamically loading textures for all kinds of game assets. Finally a contribution from Schade Studios.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |