XNA sprite loses pixels on a very pixelated image

时间:2015-09-30 23:13:20

标签: c# xna sprite

So this may be a bit vague, but I'm having some issues. Basically, I am drawing my little ninja sprite (16x16px) and on 2 frames of his animation, he loses pixels on his headband. I have looked everywhere in an attempt to find an answer, but to no avail.

Original Sprite Sheet (Bugged frames are 4th row, 3rd and 4th frames):

enter image description here

enter image description here

After a little more investigation, it seems that the bugged pixels are due to the width of the sprite sheet. It almost seems random what pixels get messed up depending on the width. However, with a constant width, the messed up pixels are constant regardless of creating a new build or using an old one.

As you can see, the back of his headband is missing pixels. While it may not be game changing, it is very annoying and if anyone knows of a fix, that'd be great! Thanks guys!

2 个答案:

答案 0 :(得分:1)

所以我找到的解决方法实际上是改变用于显示图像的矩形的大小。它设置为100,将其设置为99个作品,几乎没有任何视觉差异。

答案 1 :(得分:0)

My guess is that those pixels are magenta (255,0,255) which is automatically keyed out of the image as transparent by the SpriteTextureProcessor. If that is the case, change the pixels to be a slightly different color (255,1,255) or use the TextureProcessor for the content. You can do this in the properties window of the image file in your content project.