   Vb.net direct X sprites
  Im trying to code an little 2D platform game in vb.net.Nothing big just simple.I made it all work, but the FPS was really low because i was using the gdi engine to draw.Now im moving to direct X i encounter an big problem where i cant find an solution for, because i dont have experience with direct X.How to call multiple sprites at an efficent way?And what is the best way to move it all?i have been trying ofcource and got this:  'Sprite to be rendered  Dim Alex As Direct3D.Sprite  'Texture for the sprite  Dim AlexTexture As Texture  'Background Transparent Color  Dim ColorKeyVal As Color  Dim i As Integer = 0  Do While Not Form1.collision(i, 1) = Nothing Alex = New Direct3D.Sprite(D3Ddev) ColorKeyVal = Color.FromArgb(255, 0, 255, 0) 'LimeGreen  AlexTexture = TextureLoader.FromFile(D3Ddev, Form1.Dir & "Map/" & Form1.collision(i, 0), CInt(Form1.collision(i, 3)), CInt(Form1.collision(i, 4)), D3DX.Default, Usage.None, Format.Unknown, Pool.Default, Filter.Point, Filter.Point, ColorKeyVal.ToArgb) Alex.Begin(SpriteFlags.AlphaBlend) Alex.Draw2D(AlexTexture, New Point(0, 0), 0, New Point(CInt(Form1.collision(i, 1)), Form1.Height - (20 + CInt(Form1.collision(i, 2)) + CInt(Form1.collision(i, 4)))), Color.White) Alex.End() i += 1  LoopForm1.collision is an multidemensional array storing the collision points where the character have to stop + the image.The problem is this is not so efficient and alot worser then the gdi engine.   
  It's almost never a good idea to load stuff everytime you use it!Other than that, in Direct3D Sprite is actually not that good a name for what that class realy does. It's actually used to draw large batches of sprites at once. So you don't need multiple instances of Direc3D.Sprite but just one.So, to do it right, you should create a method/function that gets called right after your Direct3D device was created where you:1. Create a single instance of Direct3D.Sprite2. Load all the textures neededThen, when you want to draw your scene you:1. call sprite.Begin2. call sprite.Draw2D for every sprite you want to draw3. call sprite.End   ;  Thanks for your reply at my thread, but since im an beginner with directX i dont know how to do it.I have moved some lines to the initalize sub, but this is really the best i can come up with:  Dim i As Integer = 0  Do While Not Form1.collision(i, 1) = Nothing AlexTexture = TextureLoader.FromFile(D3Ddev, Form1.dir & "Map/" & Form1.collision(i, 0), CInt(Form1.collision(i, 3)), CInt(Form1.collision(i, 4)), D3DX.Default, Usage.None, Format.Unknown, Pool.Default, Filter.Point, Filter.Point, ColorKeyVal.ToArgb) Alex.Begin(SpriteFlags.AlphaBlend) Alex.Draw2D(AlexTexture, New Point(0, 0), 0, New Point(CInt(Form1.collision(i, 1)), Form1.Height - (20 + CInt(Form1.collision(i, 2)) + CInt(Form1.collision(i, 4)))), Color.White) Alex.End() i += 1  LoopIt doubles the FPS to +- 50 but thats really to slow since it only draws like 10 sprites.It needs be be able to draw an map with 200 sprites or something close to that.Could anyone help me with some code?You dont have to write it out for me, i just want to know how to store the images once and draw then fast and efficient, with an example if possible.   ;  Are you using Managed DirectX?  MDX is a dead project, MS stopped supporting it years ago.  SlimDX on the other hand is currently well-maintained, and is getting a lot of use.;  I dont have any idia :Olike i sayd i just started.   ;  I figured it out =Djust load the sprites in an texture array =Dfps from 50 to 2000 =D   