0
votes

I'm coding in c# using the XNA 4.0 framework. I have noticed that when the sprite is moved up,down,left,right (it flips to face the proper direction) the sprite is sharp and in focus similar to how it was drawn.

Example of sprite in up direction (sharp image);

enter image description here

But for some reason when I move the player diagonally in any diagonal direction it becomes slightly blurry.

Example of sprite in diagonal up/right direction (blurry image);

enter image description here

I am just rotating the object around its origin point(center of sprite), I'm not messing with any other draw attribute besides rotate and origin.

Can anyone shed some light on why this may be happening? Is this just what happens when a sprite is rotated? Is there a way I can rotate the sprite and maintain its sharpness?

---I"m not sure if this matters but the sprite is drawn facing the up direction in my sprite sheet---

1

1 Answers

1
votes

I'm not sure if this matters but the sprite is drawn facing the up direction in my sprite sheet

It does. When the sprite is going up and down, the pixels drawn to the scree can be exactly that which is in the sprite sheet, simply because they line up with the buffer. When the image is rotated, calculations need to be done to decide the best pixels to shade. This leads to some pixels being gray instead of all black and white causing the "blurring". You can play with the anti aliasing settings to get something you are happy with, but this can be a bigger issue with sprites that have hard lines like your sprite appears to have.