I ran into a problem when SpriteBatch does not draw the specified Trail with the changed alpha. What I'm trying to do is the “fade effect” when the “Item” alpha is reduced so that it becomes more transparent until it is destroyed. However, this does not change the alpha on it? Alpha decreases, but the alpha value of the color does not change, it remains the same color, and then disappears
Here's what happens: http://dl.dropbox.com/u/14970061/Untitled.jpg
And here is what I am trying to do http://dl.dropbox.com/u/14970061/Untitled2.jpg
Here's a cutout of the related code I'm currently using.
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); for (int i = 0; i < Trails.Count; i++) { Trail Item = Trails[i]; if (Item.alpha < 1) { Trails.RemoveAt(i); i--; continue; } Item.alpha -= 255 * (float)gameTime.ElapsedGameTime.TotalSeconds; Color color = new Color(255, 0, 0, Item.alpha); spriteBatch.Draw(simpleBullet, Item.position, color); } spriteBatch.End();
source share