public Map(byte[] data, Sprite sprite, BufferedReader br) throws IOException
    {
        this.sprite = sprite;

        x = width = data[0];
        y = height = data[1];
        grid = new Tile[x][y];
        
        if(data.length < x * y + 2) {
            System.out.println("Invalid map file...");
            return;
        }
        for(int i = 0; i < y; i++)
        {
            for (int j = 0; j < x; j++)
            {
                //System.out.println("x:" + j + " y:" + i + " n:" + data[i*x + j + 2]);//(i*x + j + 2));
                grid[j][i] = new Tile(j, i, data[i*x + j + 2]);

            }
        }
        x = y = 0;
    }