@Override
	public void run() 
	{
		while (!end)
		{
			//-------------------------------------------------------
			//					Main code here
			//-------------------------------------------------------
			
			//pause or unpause the gamepanel
			//xor logic for connecting buttons pause with keyboard p
			//only pause when only one of them is true
			boolean pause= !(kListenerA.pPressed()==pauseClicked);
			gamePanel.setPause((pause));
			
			//pause or unpause story panel
			if(!pause)
			{
				updateScreen();//update
				pauseSound.end();
				happyBackgroundSound.play();
				happyBackgroundSound.unPause();
			}
			else
			{
				//mp3Player.end();
				happyBackgroundSound.pause();
				pauseSound.play();

			}
			//-------------------------------------------------------
			//-------------------------------------------------------
			
			repaint(); //Calls the paint method and displays updated data accordingly
			//Delays the thread
			try 
			{
				Thread.sleep(DELAY);
			} 
			catch (InterruptedException e) {}
		}
		
	}