@Override
	public void paint(Graphics g)
	{	
		//buffer setup
		if (buffer == null)
		{
			buffer = (BufferedImage) createImage(getWidth(), getHeight());
		}
			
		if (bufferGraphics == null)
		{
			bufferGraphics = (Graphics2D) buffer.getGraphics();
		}
		//buffer clear
		bufferGraphics.clearRect(0, 0, getWidth(), getHeight());
		//draw logic
		for (int i = 0; i < players.size(); i++)
		{
			Player p = players.get(i);
			bufferGraphics.setColor(p.getColor());
			bufferGraphics.fillRect(p.getX(), p.getY(), 15, 15);
		}
		for (int i = 0; i < players.size(); i++)
		{
			Player p = players.get(i);
			bufferGraphics.setColor(Color.BLACK);
			bufferGraphics.setFont(new Font("Dialog", Font.PLAIN, 12));
			bufferGraphics.drawString(p.getName(), (int) (p.getX()+5-(2.5*p.getName().length())), p.getY()-1);
		}
		bufferGraphics.setColor(Color.BLACK);
		for (int i = 0; i < projectiles.size(); i++)
		{
			Projectile p = projectiles.get(i);
			p.draw(bufferGraphics);
		}
		for (int i = 0; i < chatLog.size(); i++)
		{
			ClientMessage e = chatLog.get(i);
			bufferGraphics.drawString(e.getMessage(), e.getX(), e.getY());
		}
		chatField.draw(bufferGraphics, name, chatMode);
		myHUD.draw(bufferGraphics);
		g.drawImage(buffer, 0, 0, null);
	}