It would be alot easier if you just posted the code in your Draw-method. Alot of people are reluctant to download an entire zipped project.
Code:
Imports System.Windows.Forms
Public Class frmMain
Public GDevice As GraphicsDevice
Public OurContent As clsContent.GameContent
Public test As Texture2D
Public SBatch As SpriteBatch
Public Function InitalizeGraphics(ByRef Surface As PictureBox) As Boolean
Dim retValue As Boolean
Try
Dim PParam As New PresentationParameters
PParam.PresentationInterval = PresentInterval.Immediate
PParam.DeviceWindowHandle = Surface.Handle
PParam.IsFullScreen = False
Dim GAdapter As GraphicsAdapter = GraphicsAdapter.Adapters.Item(0)
GDevice = New GraphicsDevice(GAdapter, GraphicsProfile.HiDef, PParam)
OurContent = New clsContent.GameContent(GDevice)
OurContent.Content.RootDirectory = "Content"
SBatch = New SpriteBatch(GDevice)
LoadGraphics()
retValue = True
Catch ex As Exception
retValue = False
End Try
Return retValue
End Function
Public Sub LoadGraphics()
test = OurContent.Content.Load(Of Texture2D)("2")
End Sub
Private Sub frmMain_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
''
P(MyIndex).Map = 1
For x = 0 To 50
For y = 0 To 50
Tile(1, x, y, LAYER_GROUND).X = 0
Tile(1, x, y, LAYER_GROUND).Y = 0
Tile(1, 3, 7, LAYER_MASK).X = 7
Tile(1, 3, 7, LAYER_MASK).Y = 0
Next
Next
For i = 0 To 50
Map(i).X = 50
Map(i).Y = 50
Next
''
Me.Show()
If InitalizeGraphics(PBGame) = False Then
MessageBox.Show("Error while initializing graphics")
End
End If
Call GameLoop()
End Sub
Private Sub GameLoop()
Dim IsRunning As Boolean = True
Do While IsRunning
GDevice.Clear(Color.CornflowerBlue)
'GROUND LAYER
SBatch.Begin()
For X = 0 To Map(P(MyIndex).Map).X
For Y = 0 To Map(P(MyIndex).Map).Y
SBatch.Draw(test, New Rectangle(X * 32, Y * 32, 32, 32), New Rectangle(Tile(P(MyIndex).Map, X, Y, LAYER_GROUND).X * 32, Tile(P(MyIndex).Map, X, Y, LAYER_GROUND).Y * 32, 32, 32), Color.White)
Next
Next
SBatch.End()
'END GROUND
'MASK LAYER
SBatch.Begin()
For X = 0 To Map(P(MyIndex).Map).X
For Y = 0 To Map(P(MyIndex).Map).Y
SBatch.Draw(test, New Rectangle(X * 32, Y * 32, 32, 32), New Rectangle(Tile(P(MyIndex).Map, X, Y, LAYER_MASK).X * 32, Tile(P(MyIndex).Map, X, Y, LAYER_MASK).Y * 32, 32, 32), Color.White)
Next
Next
SBatch.End()
'END MASK
GDevice.Present()
Application.DoEvents()
Loop
End Sub
End Class
Code:
Public Class clsContent
Public Class GameContent
Public Content As ContentManager
Private ServiceHelper As New ServiceHelper
Public Sub New(GraphicsDevice As GraphicsDevice)
ServiceHelper.GraphicsDeviceService(GraphicsDevice)
Me.Content = New Content.ContentManager(ServiceHelper)
Me.Content.RootDirectory = "Content"
End Sub
End Class
Public Class ServiceHelper
Implements IServiceProvider
Implements IGraphicsDeviceService
Public Function GetService(ByVal serviceType As System.Type) As Object Implements System.IServiceProvider.GetService
Return Me
End Function
Public Event DeviceCreated(ByVal sender As Object, ByVal e As System.EventArgs) Implements Microsoft.Xna.Framework.Graphics.IGraphicsDeviceService.DeviceCreated
Public Event DeviceDisposing(ByVal sender As Object, ByVal e As System.EventArgs) Implements Microsoft.Xna.Framework.Graphics.IGraphicsDeviceService.DeviceDisposing
Public Event DeviceReset(ByVal sender As Object, ByVal e As System.EventArgs) Implements Microsoft.Xna.Framework.Graphics.IGraphicsDeviceService.DeviceReset
Public Event DeviceResetting(ByVal sender As Object, ByVal e As System.EventArgs) Implements Microsoft.Xna.Framework.Graphics.IGraphicsDeviceService.DeviceResetting
Private _gd As GraphicsDevice
Public Sub GraphicsDeviceService(ByVal gd As GraphicsDevice)
_gd = gd
End Sub
Public ReadOnly Property GraphicsDevice() As Microsoft.Xna.Framework.Graphics.GraphicsDevice Implements Microsoft.Xna.Framework.Graphics.IGraphicsDeviceService.GraphicsDevice
Get
Return _gd
End Get
End Property
End Class
End Class
Take a look at the SpriteBatch.Begin overloads, specifically this one.
The BlendState object determines how alpha blending is handled when rendering. Pass BlendState.AlphaBlend (or null, which defaults to AlphaBlend).
I assume you have confirmed that the textures do contain an alpha channel?
Take a look at the SpriteBatch.Begin overloads, specifically this one.
The BlendState object determines how alpha blending is handled when rendering. Pass BlendState.AlphaBlend (or null, which defaults to AlphaBlend).
I assume you have confirmed that the textures do contain an alpha channel?