Flipped Sprites not displaying animations correctly

Hello everyone,

I am quite new to MonoGame so if there is a really simple fix to my problem, I do apologise.
I have a spritesheet with my character facing left. The animations play perfectly when he does anything that causes him to face left. I have used SpriteEffects.FlipHorizontally to make him face right when he moves to the right, however for some reason the animation does not play in the same way. It seems like it “stutters” forwards.

Code for both animations is identical except for the sprite effect. I’ll post two gifs showing the difference underneath this post. Thanks for the help!


One thing you could do is just draw all the individual frames out in different positions on the screen facing each direction and see if it’s drawing all the frames in the correct order.

I’ve checked and all the frames are being displayed in the correct order. I think that when the sprite is flipped, the empty space behind each frame causes it to be offset slightly? I’ll try removing that space and see what happens.

EDIT: I’ve realised that if the frame isn’t perfectly centred, there will always be an offset by flipping. I don’t know how to deal with this though.

In my perspective looks like the source rectangle is constantly changing, depending on how wide the sprite frame is. The source rectangle should be static, up to the size of the widest frame. For collision detection, you prefer to create a separate rectangle that can’t be seen, but can change dynamically if necessary.

1 Like

Ohhh I see now. I did actually have a separate rectangle for collision, but for the source rectangle, I just tried to fit it to the size of each frame independently. I’ve done what you said and now the animation works correctly!

Thank you so much!