public void mouseClicked(int clickX, int clickY) {
		
		clickY = (int)APPLET_HEIGHT - clickY;
		Point pnt = new Point(clickX, clickY);

		Point selection = new Point();
		Card clickCard;
		if (pnt.x>offsetX && pnt.x<maxX && pnt.y>offsetY && pnt.y<maxY)
		{
			selection.x = (pnt.x-offsetX)/cardSize;
			selection.y = (pnt.y-offsetY)/cardSize;
			clickCard = grid[selection.x][selection.y];

		}else{
			return;
		}
		
		//first card
		if (firstCard == null){
			firstCard = clickCard;
			SoundEffect.SELECT.play();

		//card too far away
		}else if(!isAdjacent(firstCard,clickCard)){
			firstCard = clickCard;
			SoundEffect.BAD.play();
		
		//same card
		}else if(firstCard == clickCard){
			firstCard = null;
			SoundEffect.BAD.play();
		
		//swap cards
		}else if(isAdjacent(firstCard, clickCard)){
			isSwapping=true;
			
			SwapCards(firstCard, clickCard);
			
			//make sure a match is performed
			if(CheckForMatches().size()<1){
				SwapCards(firstCard, clickCard);
				firstCard = null;
				SoundEffect.BAD.play();
			//if there is a match
			}else{
				firstCard = null;
				SoundEffect.SWAP.play();
			}
		}
	}