Code:
Sub Game_Loop()
Dim Tile_Dirt as DirectDrawSurface7
Call Load_Bitmap(16, 16, Tile_Dirt, "/tile1.bmp")
Call Draw_Bitmap(100, 100, Tile_Dirt)
End Sub
Sub Load_Bitmap(Width As Integer, Height As Integer, Bitmap_Surface_Name As DirectDrawSurface7, Bitmap_Path As String)
Set Bitmap_Surface_Name = Nothing
ddsd2.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH 'default flags
ddsd2.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
ddsd2.lWidth = Width
ddsd2.lHeight = Height
'this is where the surface is created. You use the DDraw object to create a
'surface from the specified file name using the above description.
Set Bitmap_Surface_Name = dd.CreateSurfaceFromFile(App.Path & Bitmap_Path, ddsd2)
End Sub
You never defined the Tile_Dirt Surface in the calling function. Basically, what you are doing is defining a surface that you want to use in the calling function (Game_Loop()), and passing a reference to the function "Load_Bitmap". When "Load_Bitmap" is finished, Tile_Dirt, in the calling function is a loaded bitmap file.
If you dont already understand these concepts, you may want to consider getting really familiar with Visual Basic Itself, and how it works under the covers. I assume you are using Cut-and-Pasted code, and don't understand it fully. If you learn the basics first, you wont be confused by simple things later on.
I dont mean to put you down or anything, but it will save you much time when things get really complicated.
Z.