SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice); Texture2D texture = Content.Load("sprite"); spriteBatch.Begin(); spriteBatch.Draw(texture, new Vector2(100, 100), Color.White); spriteBatch.End();
SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice); ListThis code creates a list of multiple textures, and then uses a for loop to draw each texture at a different position on the screen. Overall, the Microsoft.Xna.Framework.Graphics package library provides a powerful set of tools for creating high-performance 2D and 3D graphics in C#. The SpriteBatch class, in particular, makes it easy to efficiently render large numbers of sprites in games and other applications.textures = new List (); textures.Add(Content.Load ("sprite1")); textures.Add(Content.Load ("sprite2")); textures.Add(Content.Load ("sprite3")); spriteBatch.Begin(); for (int i = 0; i < textures.Count; i++) { spriteBatch.Draw(textures[i], new Vector2(i * 50, 100), Color.White); } spriteBatch.End();