Time for action – the MapSquare class
Add a new class called
MapSquare.cs
to the "Tile Engine" project.Add the following
using
directives to the MapSquare class:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics;
Modify the declaration of the MapSquare class by adding the
[Serializable]
attribute before the class declaration, and making the class public:[Serializable] public class MapSquare
Add the declarations region to the MapSquare class:
#region Declarations public int[] LayerTiles = new int[3]; public string CodeValue = ""; public bool Passable = true; #endregion
Add a constructor to the MapSquare class:
#region Constructor public MapSquare( int background, int interactive, int foreground, string code, bool passable) { LayerTiles[0] = background; LayerTiles[1] = interactive; LayerTiles[2] = foreground; CodeValue = code; Passable = passable; } #endregion
Add the
TogglePassable()
method to the MapSquare class:#region Public Methods...