How to use animation offset in libgdx from texturepacker

While trying some new things after working all days, I encountered something annoying .. when I used texturepacker gui from codeandweb, the packer packs my image into one and use offset to maximize its compression.

This kind of packing is actually good, but it’s a little annoying because we must set the offset in libgdx to actually make the animation position line-up.

Packed by texturepacker
Packed by texturepacker

I browsed through google to find how to actually get the offset and apply it to the animation function in libgdx, but luck not in my side for a whole day … ah, as reminder I used this code to apply rotation from the left bug, because if you used the sprite as it is, you will get the same as the sprite above for animation.

Continue reading »