Пример #1
0
 public static void setMapTileIndexIfOnTileSheet(Map map, int x, int y, int index, string layer, int tileSheetToMatch)
 {
     if (SheetHelper.isTileOnSheet(map, layer, x, y, tileSheetToMatch))
     {
         map.GetLayer(layer).Tiles[x, y].TileIndex = index;
     }
 }
Пример #2
0
        public static int getFloorSpriteIndex(Map map, int x, int y)
        {
            int index = -1;

            if (SheetHelper.isTileOnSheet(map, "Back", x, y, SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 21, 16, 20)))
            {
                index = map.GetLayer("Back").Tiles[x, y].TileIndex;
            }
            return(index);
        }
Пример #3
0
        public static int getWallSpriteIndex(Map map, int x, int y)
        {
            int index = -1;

            if (SheetHelper.isTileOnSheet(map, "Back", x, y, SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 0, 16, 21)))
            {
                index = map.GetLayer("Back").Tiles[x, y].TileIndex;
            }
            else if (SheetHelper.isTileOnSheet(map, "Buildings", x, y, SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 0, 16, 21)))
            {
                index = map.GetLayer("Buildings").Tiles[x, y].TileIndex;
            }
            else if (SheetHelper.isTileOnSheet(map, "Front", x, y, SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 0, 16, 21)))
            {
                index = map.GetLayer("Front").Tiles[x, y].TileIndex;
            }
            return(index);
        }
Пример #4
0
 internal static void setMapTileIndexesInSquare(Map map, Rectangle floor, int x, int y, int index)
 {
     if (floor.Contains(x, y))
     {
         setMapTileIndexIfOnTileSheet(map, x, y, index, "Back", SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 21, 16, 10));
     }
     if (floor.Contains(x + 1, y))
     {
         setMapTileIndexIfOnTileSheet(map, x + 1, y, index + 1, "Back", SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 21, 16, 10));
     }
     if (floor.Contains(x, y + 1))
     {
         setMapTileIndexIfOnTileSheet(map, x, y + 1, index + 16, "Back", SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 21, 16, 10));
     }
     if (floor.Contains(x + 1, y + 1))
     {
         setMapTileIndexIfOnTileSheet(map, x + 1, y + 1, index + 17, "Back", SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 21, 16, 10));
     }
 }
Пример #5
0
 internal static void setFloorMapTileIndexForAnyLayer(Map map, int x, int y, int index)
 {
     setMapTileIndexIfOnTileSheet(map, x, y, getFloorIndex(map, x, y, "Back", index), "Back", SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 21, 16, 10));
     setMapTileIndexIfOnTileSheet(map, x, y, getFloorIndex(map, x, y, "Buildings", index), "Buildings", SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 21, 16, 10));
     setMapTileIndexIfOnTileSheet(map, x, y, getFloorIndex(map, x, y, "Front", index), "Front", SheetHelper.getTileSheet(map, "walls_and_floors"), new Rectangle(0, 21, 16, 10));
 }