# Render character in bounding box

i'm rendering an attack animation with the following code:

currentFrame = attackAnimation[3].getKeyFrame(stateTime, false); //3 : left, 2: right
batch.draw(currentFrame, getX(), getY());


This renders the CurrentFrame on the x and y position of the character. This works fine for the right animation as you can see here:

but when i apply the same code for left for example it doesn't draw the character on the correct place and like "pushes himself away" from the bottom left corner and leaving the bounding box.

What am I doing wrong or what am I not seeing?

setGameObject(new Sprite(txtIdle[2]));
setSize(getWidth(), getHeight());
setOrigin(getWidth() /2.0f, getHeight() /2.0f);
setPosition(500, 500);


this code sets an idle image and the size of the bounding box (and the sprite)

One possible way to fix this would be to render the sword separately from Link's body. The bounding box is just large enough to contain Link, so you could render the sword just outside the bounding box at position (box corner.x + box width, box corner.y) when facing right and at (box corner.x - sword width, box corner.y) when facing the left.