changes the color of a clicked cell and saves the index of the current cube