Hey guys,
so im working on my own game and i want to draw the map on starting the game.
I am drawing the map to a rendertarget but when I draw it to the game itself it is just a black square.
My code how im doing it:
graphicsDevice.SetRenderTarget(_MapRenderTarget) graphicsDevice.Clear(Color.Black) Using spritebatch As New SpriteBatch(graphicsDevice) spritebatch.Begin() Dim x As Integer = 0 Dim y As Integer = 0 For Each tileInfo In mapInfo.MainLayer.TileIndex Dim xPos As Integer Dim yPos As Integer yPos = CInt(Fix(tileInfo / 8)) xPos = tileInfo - yPos * 8 spritebatch.Draw(mapInfo.TileSet, New Rectangle(x * 32, y * 32, 32, 32), New Rectangle(xPos * 32, yPos * 32, 32, 32), Color.Black) x += 1 If (x * 32) > mapInfo.Size.X Then y += 1 x = 0 End If Next spritebatch.End() End Using graphicsDevice.SetRenderTarget(Nothing) Return DirectCast(_MapRenderTarget, Texture2D)
When im trying to draw it directly onto the scene without the rendertarget it is working great.
Someone has an idea what the problem is?
PS: sorry for my bad english.