Time for action – adding the tile map to the game project
Right-click on the Gemstone Hunter project in Solution Explorer, and click on Add Reference....
Click on the Projects tab in the Add Reference window, and ensure that the Tile Engine project is selected. Click on OK:
Open the
Game1.vb
file in the Gemstone Hunter project, and add the followingImports
directive to the top of the file:Imports Tile_Engine
Add the following to the
LoadContent()
method of theGame1
class:TileMap.Initialize(Content.Load(Of Texture2D)("Textures\PlatformTiles")) TileMap.SetTileAtCell(3, 3, 1, 10) Camera.WorldRectangle = new Rectangle(0, 0, 160 * 48, 12 * 48) Camera.Position = Vector2.Zero Camera.ViewPortWidth = 800 Camera.ViewPortHeight = 600
Replace the current
Draw()
method of theGame1
class with the following:Protected Overrides Sub Draw(gameTime As GameTime) GraphicsDevice.Clear(Color.Black) spriteBatch.Begin( SpriteSortMode.BackToFront, BlendState.AlphaBlend) TileMap.Draw(spriteBatch) spriteBatch...