@Override
    public void run() { 
        while(true) { 
	        if (playing && !gameOver){
	        	try {
					Thread.sleep(1000/30); //sleep for 1/30 second

					//if (!gameOver) {
						moveBall();
						movePaddle();
						if (dx>0) checkForHit();

						if(misses == 3){
							gameOver = true;
							score = hits * difficulty;
							highScore();
							repaint();
							playing = false;
						}
					//}
				} catch (InterruptedException ie) {	
				} catch (ClassNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}


	        } else {
	        	Thread.yield();
	        }	
        } 
    }