What do you mean by "Multiple levels of transparency"?
Check this out:
http://cotw.11.forumer.com/viewtopic.php?t=113
(on page 2 I have a screen shot after I made the game a playable demo
It's a game I've been working on in VB.Net using VS VB.Net 2008 Express Edition. I use PNG's, BMP's, and GIF's to store Transparency in my saved image. The VB.Net Bitmap object recognizes that transparency.
In the game, Most of my Class Objects inherit from a base class:
Public Class COTW_Element
Public X As Integer
Public Y As Integer
Public Col As Integer
Public Row As Integer
Public Solid As Boolean = False
Public isConsumed As Boolean = False
Public Event Hit(ByRef Sender As Object, ByRef e As EventArgs)
Public Sub New()
End Sub
Public Sub New(ByVal _X As Integer, ByVal _Y As Integer, ByVal _R As Integer, ByVal _C As Integer)
End Sub
Public Function isInTile(ByRef R As Integer, ByRef C As Integer) As Boolean
Return (R = Row And C = Col)
End Function
End Class
and then have a "DrawOntoGraphics" routine like this:
Public Class COTW_Player
Inherits COTW_Element
Dim imageLoaded As Boolean
Dim poisoned As Boolean
Dim poisonLevel As Integer
Dim img As Bitmap
Dim Container As COTW_Container
Public Sub New(ByVal ImagePath As String)
Me.X = 0
Me.Y = 0
Me.Col = 0
Me.Row = 0
Try
Me.img = New Bitmap(Application.StartupPath.Trim("\") & "\" & ImagePath)
Me.imageLoaded = True
Catch ex As Exception
End Try
Container = New COTW_Container
End Sub
Public Sub New()
Me.X = 0
Me.Y = 0
Me.Col = 0
Me.Row = 0
Container = New COTW_Container
End Sub
Public Sub addItem(ByVal NewItem As COTW_Item)
Container.addItem(NewItem)
End Sub
Public Function rmvItem(ByVal Index As Integer) As Object
Dim Item As Object = Container.rmvItem(Index)
Return Item
End Function
Public Sub gotHit() Handles MyBase.Hit
End Sub
Public Sub drawOntoGraphics(ByRef G As Graphics)
G.DrawImage(img, New Point(X, Y))
End Sub
Public Sub Move(ByRef _Row As Integer, ByRef _Col As Integer, ByRef _X As Integer, ByRef _Y As Integer)
Col = _Col
Row = _Row
X = _X
Y = _Y
End Sub
End Class
Inside of my Engine object, I have a "PaintDisplay" object which gets the Level image (which is dynamically generated by analyzing each tile and painting them into a master image) and then draws on the Player object. The player object has transparency which work's just fine:
Private Sub PaintDisplay()
If Not IsNothing(Level) Then
Dim BMP As Bitmap = Level.getImage()
Dim G As Graphics = Graphics.FromImage(BMP)
Player.drawOntoGraphics(G)
pcbDisplay.Image = BMP
End If
End Sub
I should note that ClsPlayer.drawOntoGraphics takes the Graphics object as ByRef (so I don't have to return a value, the Graphics object that was passed is directly manipulated inside of the DrawOntoGraphics routine, instead of a New Value being created (if you used ByVal).
pcbDisplay is a picturebox, so when I want to update the display, I just insert the new BMP, and some background Windows process triggers it to RePaint that display.
That said, if you are serious about game development, VB.Net is probably not the language you want to use. C#.Net has a package from Microsoft called "XNA Framework" which is specifically designed to develop games (I moved on from this project to working in XNA, and will be converting the whole project to XNA after I finish the game I am working on now).
Using XNA requires you to own a license of Visual Studio, as I don't think there is a version that works with C#.Net Express Edition (which is cheap if you are a student in college or highschool). XNA is also C# only, I don't know if they plan to allow support for VB.
Anyway, back to your question. Sounded more like you were interested in drawing layers, which have transparency... So here is how I would approach it:
'At the beginning of the game, at Load time of the level or game itself
'load the Layers into Layer objects as follows:
'These Layer Images should contain transparency saved directly into them
Dim Layers() As Bitmap
Dim Player As Bitmap
Dim Tiles(,) as Bitmap
Dim HUD as Bitmap
Public Sub DrawDisplay()
'All of these arrays and bitmaps should be initialized by this point
Dim DisplayBMP As Bitmap = New Bitmap(_Columns * _TileWidth, Rows * _TileHeight)
'Creates the graphics object that lets you draw into a Bitmap object
Dim G as Graphics = Graphics.FromImage(DisplayBMP)
'Clear the BMP with white first
G.Clear(Color.White)
'Draw the objects in the farthest background first, thats your Layers
Dim i as integer = 0
For i = 0 to Layers.Count - 1
G.DrawImage(Layers(i), New Point(0, 0)) 'assumes the layer stays still
Next i
'Draw the tiles
Dim r as integer
Dim c as integer
for r = 0 to _TileRows - 1
For c = 0 to _TileCols - 1
G.DrawImage(Tiles(c, r), New Point(c * _TileWidth, r * _TileHeight))
Next c
Next r
'Draw the player
G.DrawImage(Player, New Point(PlayerX, PlayerY))
'Draw the Heads up Display - which is the front most object
G.DrawImage(HUD, New Point(0, 0))
'Finally, we need to assign that BMP to something
PictureBox1.Image = BMP 'should automatically repaint when this Sub ends
End Sub
Thats a very simple example of how to draw images that have transparency onto a Bitmap and assigns that to a picture box image.
Hope this helps, may be too complex of an answer tho, so DO ask away,
Sean C