How do I draw copies of the leading texture so that there is a line of the leading ball following behind it? (that don't collide)

So far I have tried to create the effect by placing another graphic 2 pixels off the graphic, but I don't see the second ball being drawn.

spriteBatch.Draw(ballTexture, ballPos, null, Color.White, 0.0f, new Vector2(Ballpos.X +2, ballPos.Y +2), ballSize, SpriteEffects.None, 0);


  • 3
    \$\begingroup\$ Do you have transparency working properly, so that the second draw isn't completely overwritten by the first? \$\endgroup\$ Oct 23, 2013 at 15:39
  • \$\begingroup\$ I don't understand what you mean, shouldn't it draw anyway? \$\endgroup\$
    – Evan
    Oct 24, 2013 at 8:54
  • \$\begingroup\$ Maybe, it depends on the bounds of your sprite and the draw settings. Some settings would wipe out colored pixels from previous sprites with transparent pixels from subsequent draws. \$\endgroup\$ Oct 24, 2013 at 13:34
  • 3
    \$\begingroup\$ In your SpriteBatch.Draw call you aren't changing the position of the ball, you are changing the texture origin, likely to be outside the available texture area. This is why you see nothing changed. Drawing at ballPos + new Vector2(2, 2) should draw the second version. That alone will not answer your question though, as you would need to account for the ball direction to properly place the previous version. \$\endgroup\$ Oct 24, 2013 at 17:34

1 Answer 1


store the location of the ball last frame and draw that, or if that is too close store the location 5 frames ago

alternatively if you know the direction of the ball use

for(int i = 1; i<5; i++)
  var drawposition = ball.position - (i * ball.direction);
  var colour = Color.Lerp(Color.White,Color.Transparent,i*(20/100f));
  //SpriteBatch.Draw at drawposition with colour

where _time is the time since last frame. although down side of this is that it will not map actual path accurately

just be sure the ball is not so close as to confuse it with the current ball

  • \$\begingroup\$ I've followed the code, and I've produced the effect without the _time (I do not know how to, and could not make a timer for time since last frame) I will also need to add transparency that increases the further the ball is \$\endgroup\$
    – Evan
    Oct 25, 2013 at 15:10
  • \$\begingroup\$ Thanks for the edit, but unfortunately the transparency not work. If you can, could you also explain to me how to create a time since last frame timer? \$\endgroup\$
    – Evan
    Oct 27, 2013 at 13:57
  • \$\begingroup\$ My bad, I didn't add the colour variable. I'm still relatively new to XNA. Thanks! \$\endgroup\$
    – Evan
    Oct 28, 2013 at 9:34
  • \$\begingroup\$ the time is part of the update method, however you can also include it as part of the draw. it is probably better really to create your objects you wish to draw as part of the update then wait until the draw to render them although in this instance you probably safe to ignore it \$\endgroup\$
    – RoughPlace
    Oct 28, 2013 at 13:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .