# Dealing with "jumping" sprites: badly centered?

Thing is, I've used darkFunction Editor as a way to get all the spriteCoordinates off a spriteSheet for each individual sprite, and parse the .xml it generates inside my game. It all works fine, except when the sprites are all similarly sized, but when a sprite changes from a small sprite into a big one, such as here:

When from walking from some direction, to attacking, it starts "jumping", appearing glitchy, because it's not staying in the same correct position, only doing so for the right attacking sprite, due to the drawing being made from the lower left part of the rectangle.

I think someone experienced will immediately recognize the problem I mean, if not, when I return home soon, I will shoot a little youtube video demonstrating the issue!

So the question is: what possible solutions are there? I've thought that some sort of individual frame "offset" system might be the answer, or perhaps splitting, in this case, the sprite in 2: the sword, and the character itself, and draw sword according to character's facing, but that might be overly complex. Another speculation would be that there might be some sort of method in LibGdx, the library I'm using, that allows me to change the drawing center (which I looked for and didn't find), so I could choose from where the drawing starts.

• For small projects, I have always overcome the issue by setting the sprite size to the largest sprite available and aligning all properly (on sheet). Other option is to, yes, store offsets and displace on draw. May 31, 2013 at 8:15
• There are lots of solutions. You've already identified 3. Is there a problem with any of the solutions you're looking at that you have a specific problem with? May 31, 2013 at 8:18
• Yes, several: as for the suggestion above of aligning the sprite to it's biggest possible size, it's what I used to do, but I found myself losing so much time aligning every pixel of all the animations of all the sprites... very time consuming, which i against what I had tried to do, save time, by selecting sprites in darkFunctionEditor, and parsing the .xml. And another huge drawback of this: my hitboxes ARE the sprite sizes, the way I have this designed. (sort of a placeholder, but still) Offset - huge complications, hitbox issues again, loads changes... May 31, 2013 at 12:55
• As for the one pertaining changing the way LibGdx draws, from where, can't find how to do so/if it is possible, and as for the one that is about splitting sprites, that's likely the biggest, most messiest solution of all and would only work in specific cases such as this where I had one big thing I can consider a sole "sprite" sticking out of the character's rectangle, so to say. May 31, 2013 at 12:56

batch.draw(texture, x, y, srcX, srcY, srcWidth, srcHeight)