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.cs file in the Gemstone Hunter project and add the following
using
directive to the top of the file:using Tile_Engine;
Add the following to the
LoadContent()
method of the Game1 class:TileMap.Initialize( Content.Load<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 the Game1 class with the following:protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin( SpriteSortMode.BackToFront, BlendState.AlphaBlend); TileMap...