@Override
	public void run() {
		while (true) {
			if (playing && !gameOver) {
				try {
					Thread.sleep(1000 / 30); // sleep for 1/30 second
					moveBall();
					try {
						playerOne.movePaddle(player1FlagUp, player1FlagDown);
						playerTwo.movePaddle(player2FlagUp, player2FlagDown);
						repaint();
					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}

					if (dx > 0) {
						checkForHitRight(playerOne);
					} else if (dx < 0) {
						checkForHitLeft(playerTwo);
					}

					if(hits1 == 11 || hits2 == 11){
						gameOver = true;
						repaint();
						playing = false;
					}
				} catch (InterruptedException ie) {
				}

			} else {
				Thread.yield();
			}

		}
	}