package G1.market_simple;

import java.awt.Graphics;

public class Salesman  extends Thread implements Drawable{
	private int x,y;
	private int c;
	private boolean full;
	private int dx,dy;
	private MarketPanel panel;
	
	public Salesman(int x, int y, int c, boolean full, int dx, int dy, MarketPanel panel) {
		super();
		this.x = x;
		this.y = y;
		this.c = c;
		this.full = full;
		this.dx = dx;
		this.dy = dy;
		this.panel=panel;
	}
	
	@Override
	public void drawSelf(Graphics g) {
		g.drawOval(x, y, 5,5);
	}
	
	private void move(){
		x+=dx;
		y+=dy;
	}
	
	@Override
	public void run() {
		while(true){
			move();
			panel.repaint();
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
