Inheritance: TileSet
示例#1
0
        public static void CreateWalls(ContentManager _content, string name)
        {
            WallTiles _tiles = new WallTiles(_content, 128, 192, "");
            _tiles.Add(name + "a", WallDir.UpRight, new Rectangle(0, 768, 128, 192));
            _tiles.Add(name + "a", WallDir.LeftRightUp,
         new Rectangle(640, 596, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.LeftRightDown,
            new Rectangle(768, 596, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.UpDownLeft,
            new Rectangle(896, 596, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.UpDownRight,
            new Rectangle(512, 596, 128, 192), new Backend.Coords(0, 20));

            _tiles.Add(name + "a", WallDir.UpLeft, new Rectangle(128, 768, 128, 192));
            _tiles.Add(name + "a", WallDir.DownLeft, new Rectangle(256, 576, 128, 192));
            _tiles.Add(name + "a", WallDir.DownRight, new Rectangle(384, 576, 128, 192));
            _tiles.Add(name + "a", WallDir.LeftRight, new Rectangle(0, 584, 128, 184), new Backend.Coords(0, 8));
            _tiles.Add(name + "a", WallDir.UpDown, new Rectangle(128, 584, 128, 184), new Backend.Coords(0, 8));
            _tiles.Add(name + "a", WallDir.FourWay, new Rectangle(384, 768, 128, 192));
            _tiles.Add(name + "a", WallDir.RightClose, new Rectangle(256, 192, 128, 192));
            _tiles.Add(name + "a", WallDir.UpClose, new Rectangle(128, 212, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.LeftClose, new Rectangle(384, 192, 128, 192));
            _tiles.Add(name + "a", WallDir.DownClose, new Rectangle(0, 212, 128, 172), new Backend.Coords(0, 20));

            _tiles.Add(name + "a", WallDir.UpRightDiag,
            new Rectangle(566, 400, 20, 96), new Backend.Coords(54, 15), new Backend.Coords(54, 81));
            _tiles.Add(name + "a", WallDir.UpLeftDiag,
            new Rectangle(321, 20, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.DownLeftDiag,
            new Rectangle(384, 384, 128, 192));
            _tiles.Add(name + "a", WallDir.DownRightDiag,
            new Rectangle(128, 384, 128, 192));
            _tiles.Add(name + "a", WallDir.UpDownLeftDiag,
            new Rectangle(640, 384, 128, 192));
            _tiles.Add(name + "a", WallDir.UpDownDiag,
            new Rectangle(0, 384, 128, 192));
            _tiles.Add(name + "a", WallDir.FourDiag,
            new Rectangle(256, 768, 128, 192));
            _tiles.Add(name + "a", WallDir.RightCloseDiag,
            new Rectangle(149, 46, 22, 50), new Backend.Coords(53, 61), new Backend.Coords(53, 82)); // wrong size!
            _tiles.Add(name + "a", WallDir.UpCloseDiag,
            new Rectangle(257, 20, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.LeftCloseDiag,
            new Rectangle(385, 20, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.DownCloseDiag,
            new Rectangle(210, 0, 30, 192), new Backend.Coords(51, 0), new Backend.Coords(49, 0)); // Wrong size!
            _tiles.Add(name + "a", WallDir.LeftRightUpDiag,
            new Rectangle(896, 384, 128, 192));
            _tiles.Add(name + "a", WallDir.LeftRightDownDiag,
            new Rectangle(768, 384, 128, 192));
            _tiles.Add(name + "a", WallDir.LeftRightDiag,
            new Rectangle(256, 384, 128, 192));
            _tiles.Add(name + "a", WallDir.UpDownRightDiag,
            new Rectangle(512, 384, 128, 192));
            _tiles.Add(name + "a", WallDir.DiagUpClose,
            new Rectangle(640, 192, 128, 192));
            _tiles.Add(name + "a", WallDir.DiagDownClose,
            new Rectangle(896, 20, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.DiagUpClose2,
            new Rectangle(512, 192, 128, 192));
            _tiles.Add(name + "a", WallDir.DiagDownClose2,
            new Rectangle(768, 20, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.DiagLeftClose,
            new Rectangle(640, 20, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.DiagRightClose,
            new Rectangle(896, 192, 128, 192));
            _tiles.Add(name + "a", WallDir.DiagLeftClose2,
            new Rectangle(512, 20, 128, 172), new Backend.Coords(0, 20));
            _tiles.Add(name + "a", WallDir.DiagRightClose2,
            new Rectangle(768, 192, 128, 192));
            _tiles.Add("Column", WallDir.Free, new Rectangle(1920, 0, 128, 192));



            _tiles.Add(name + "b", WallDir.UpLeftDiag, new Rectangle(192, 0, 64, 176), new Backend.Coords(32, 16), new Backend.Coords(32, 0), Backend.WallType.OpenDoor);
            _tiles.Add(name + "b", WallDir.UpLeftDiag, new Rectangle(128, 0, 64, 176), new Backend.Coords(32, 16), new Backend.Coords(32, 0), Backend.WallType.ClosedDoor);


            _tiles.Add(name + "b", WallDir.UpDown, new Rectangle(0, 211, 128, 172), new Backend.Coords(0, 20), null, Backend.WallType.ClosedDoor);
            _tiles.Add(name + "b", WallDir.UpDown, new Rectangle(128, 211, 128, 172), new Backend.Coords(0, 20), null, Backend.WallType.OpenDoor);


            _tiles.Add(name + "b", WallDir.LeftRight, new Rectangle(384, 211, 128, 172), new Backend.Coords(0, 20), null, Backend.WallType.OpenDoor);
            _tiles.Add(name + "b", WallDir.LeftRight, new Rectangle(256, 211, 128, 172), new Backend.Coords(0, 20), null, Backend.WallType.ClosedDoor);


            _tiles.Add(name + "b", WallDir.UpLeftDiag, new Rectangle(256, 0, 128, 192), new Backend.Coords(32, 16), new Backend.Coords(32, 0), Backend.WallType.Deco1);
            _tiles.Add(name + "b", WallDir.UpLeftDiag, new Rectangle(320, 0, 128, 192), new Backend.Coords(32, 16), new Backend.Coords(32, 0), Backend.WallType.Deco2);
            _tiles.Add(name + "b", WallDir.UpLeftDiag, new Rectangle(384, 0, 128, 192), new Backend.Coords(32, 16), new Backend.Coords(32, 0), Backend.WallType.Deco3);


            _tiles.Add(name + "b", WallDir.UpDown, new Rectangle(0, 576, 127, 191), null, new Backend.Coords(1, 1), Backend.WallType.Deco1);
            _tiles.Add(name + "b", WallDir.UpDown, new Rectangle(256, 576, 127, 191), null, new Backend.Coords(1, 1), Backend.WallType.Deco2);
            _tiles.Add(name + "b", WallDir.UpDown, new Rectangle(0, 768, 128, 192), null, null, Backend.WallType.Deco3);

            _tiles.Add(name + "b", WallDir.LeftRight, new Rectangle(128, 575, 128, 192), null, null, Backend.WallType.Deco1);
            _tiles.Add(name + "b", WallDir.LeftRight, new Rectangle(384, 576, 127, 191), null, new Backend.Coords(1, 1), Backend.WallType.Deco2);
            _tiles.Add(name + "b", WallDir.LeftRight, new Rectangle(128, 768, 128, 192), null, null, Backend.WallType.Deco3);

            _tiles.Save("Content\\" + name + ".xml");
        }
示例#2
0
        public static void CreateFloor(ContentManager _content, string name)
        {
            WallTiles tmp = new WallTiles(_content, 128, 96, "");

            tmp.Add(name, WallDir.None, new Rectangle(512, 384, 128, 96));
            tmp.Save("Content\\" + name + ".xml");

        }
示例#3
0
        /// <summary>
        /// Create the visible version of the game map
        /// </summary>
        /// <param name="graphics">The core graphics device manager</param>
        /// <param name="spriteBatch">A sprite batch used for drawing</param>
        /// <param name="displayArea">The area on wich the map will be placed</param>
        /// <param name="floor">The textures used for the floor</param>
        /// <param name="wall1">A set of tiles for the walls</param>
        /// <param name="wall2">A set of tiles for doors</param>
        /// <param name="map">Internal storage of map data</param>
        public Mainmap(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayArea, Backend.Map map, bool enabled = true)
            : base(parent, spriteBatch, content, displayArea)
        {
            _font = _content.Load<SpriteFont>("font");
            _map = map;
            _background = _content.Load<Texture2D>("Minimap");
            _circle = _content.Load<Texture2D>("Light2");
            _highlightedTile = new Backend.Coords(-1, -1);
            _tooltip = new TileTooltip(this, _spriteBatch, _content, _displayRect);
            // Load textures to use in environment
            // 1. Walls and floor
            _walls = new WallTiles(_content, 128, 192, "");
            _floors = new WallTiles(_content, 128, 192, "");

            // 2. Environmental objects (floor, items, traps, teleporters, chest...)
            _environment = new List<TileSet>();
            _environment.Add(new TileSet(_content, 128, 192));
            _environment[0].Load("Content\\misc.xml");
            _environment.Add(new TileSet(_content, 64, 48));
            _environment[1].Load("Content\\Arrow.xml");
            _environment.Add(new TileSet(_content, 55, 55));
            _environment[2].Load("Content\\explosion.xml");

            // 3. Moving entities (player, NPCs, enemies)
            _actors = new List<ActorView>();
            _effects = new List<MapEffect>();

            resetActors();
            _floatnumbers = new List<FloatNumber>();
            _projectiles = new List<Projectile>();
            _enabled = enabled;
        }