コード例 #1
0
        /// <summary>
        /// A pre-made method which shows how to construct a house
        /// </summary>
        /// <returns></returns>
        private MapCellExtension[,] constructHouse()
        {
            MapCellExtension[,] houseBlock = new MapCellExtension[4, 2];

            MapCellExtension cell;

            //0, 0, left corner
            cell = new MapCellExtension(70, false, false, false, false);
            cell.AddTile(91, 0);
            cell.AddTile(31, 1);
            houseBlock[0, 0] = cell;

            //0, 2, top corner
            cell = new MapCellExtension(70, false, false, false, false);
            cell.AddTile(51, 0);
            houseBlock[0, 1] = cell;

            //1, 0, bottom wall
            cell = new MapCellExtension(70, false, false, false, false);
            cell.AddTile(91, 0);
            cell.AddTile(31, 1);
            houseBlock[1, 0] = cell;

            //1, 1, top wall
            cell = new MapCellExtension(70, false, false, false, false);
            cell.AddTile(60, 0);
            houseBlock[1, 1] = cell;

            //2, 0, bottom wall
            cell = new MapCellExtension(70, false, false, false, false);
            cell.AddTile(91, 0);
            cell.AddTile(31, 1);
            houseBlock[2, 0] = cell;

            //2, 1, top wall
            cell = new MapCellExtension(70, false, false, false, false);
            cell.AddTile(60, 0);
            houseBlock[2, 1] = cell;

            //3, 0, right corner
            cell = new MapCellExtension(70, false, false, false, false);
            cell.AddTile(91, 0);
            cell.AddTile(31, 1);
            houseBlock[3, 0] = cell;

            //3, 1, bottom corner
            cell = new MapCellExtension(70, false, false, false, false);
            cell.AddTile(94, 0);
            cell.AddTile(37, 1);
            houseBlock[3, 1] = cell;

            //send it out!
            return(houseBlock);
        }
コード例 #2
0
        public static void LoadContent(Game game)
        {
            if (NPCtexture == null)
            {
                NPCtexture = game.Content.Load <Texture2D>(@"Textures\NPCs\LineArt");
            }

            sources = new Rectangle[4];
            for (int i = 0; i < 4; i++)
            {
                sources[i] = new Rectangle(0, 64 * i, 64, 64);
            }

            HighlightCell = new MapCellExtension(1, false, false, false, false);
        }