Exemplo n.º 1
0
        public WorldLayer(int width, int height, TileType solidType = TileType.Air)
        {
            Tiles = new Tile[width, height];

            for (int i = 0; i < width; i++)
                for (int j = 0; j < height; j++)
                    Tiles [i, j] = new Tile (solidType);
        }
Exemplo n.º 2
0
        Rectangle getTileSourceRect(Tile t)
        {
            int id = (int)t.Type;

            int spriteSheetTileWidth = SpriteSheetWidth / TileWidth;

            int y = id / spriteSheetTileWidth;
            int x = id % spriteSheetTileWidth;

            return new Rectangle (x * TileWidth, y * TileWidth, TileWidth, TileWidth);
        }