Time for action – the TileMap class – part 1
In the Tile Engine project, rename the
Class1.cs
file that was generated by the Game Library project template toTileMap.cs
. Visual Studio will ask you if you wish to rename all references to the class as well. Go ahead and click on Yes. We have not referenced our new class anywhere, so no other code is actually updated.Double-click on the new
TileMap.cs
file to open it in the Visual Studio editor.Add the following
using
directives to the top of the class file:using Microsoft.Xna.Framework.Storage; using System.IO; using System.Xml.Serialization; using System.Runtime.Serialization.Formatters.Binary;
Modify the declaration of the TileMap class to make the class public and static:
public static class TileMap
Add declarations to the TileMap class:
#region Declarations public const int TileWidth = 48; public const int TileHeight = 48; public const int MapWidth = 160; public const int MapHeight = 12; public const int MapLayers = 3; private const int skyTile...