Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm drawing a name above the player's head in a 2D top down view game. The code to draw the string looks like this:

Vector2 textPos = new Vector2(
  (positionX * 2 * world.Map.TileWidth + (16 -(SmallFont.MeasureString(mName).X / 2))),
  (positionY * 2 * world.Map.TileWidth - 32));

spriteBatch.DrawString(SmallFont, mName, textPos, Color.White, 0, Vector2.Zero,
  1, SpriteEffects.None, 1);

The text is drawn to the position right above the player's head just fine, and it follows the player as he moves just fine as well. But the problem is that when the player moves, the text kind of gets thicker and ugly. I tried screen capping it but the screenshot doesn't capture the problem (because it's just taking a single frame, I presume).

Anyways, does anyone have an idea of what I could do to fix this?

share|improve this question
Like I've mentioned in the chat, you should either floor, round or ceil the values. When it attempts to draw between pixels, it'll do some sort of interpolating effect that doesn't work with things that need crisp lines. –  William 'MindWorX' Mariager May 27 '12 at 20:48
I tried casting the vector values to int, but the problem still occurs. I've removed them since. –  JMRboosties May 27 '12 at 21:25
Try to draw it with SamplerState.PointClamp –  Blau May 28 '12 at 11:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.