public void paintComponent(Graphics g) 
    {
    	time=game.getTotalTime();
    	
    	if(offscreen==null)
    	{
    		offscreen=(BufferedImage)createImage(this.getPreferredSize().width,this.getPreferredSize().height); 
    		bufferGraphics=offscreen.getGraphics();
    	}   	
    	
        drawMaze();        
        drawDebugInfo();	//this will be used during testing only and will be disabled in the competition itself        
        drawPills();
        drawPowerPills();
        drawPacMan();
        drawGhosts();
        drawLives();
        drawGameInfo();
        
        if(game.gameOver())
        	drawGameOver();
        
        g.drawImage(offscreen,0,0,this);
        
        if(saveImage)
        	saveImage();
    }