I am starting learning C# and XNA, and I want to display an animated sprite (moved by my keyboard).
I've got this sprite file:
To display only the part I need, I use this code:
Rectangle cuttedSprite = new Rectangle(
this.W * (int)this.mCurSprite.X,
this.H * (int)this.mCurSprite.Y,
this.W,
this.H
);
spriteBatch.Draw(this.mSpriteTexture, this.mPosition, cuttedSprite, Color.White);
But my problem is that the rendered image is blurred after moving:
I tried to fix this by changing the SamplerStates
, but nothing changed. Does anyone have an idea to help me?
SamplerState.PointWrap
. Also, sincemPosition
is probably aVector2
, try roundingmPosition.X
andmPosition.Y
to the nearest integers. – Spikenard