import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;


public class Bat extends WObject implements MouseMotionListener {

	
	static final double batHeight = 4.0;
	static final double batWidth = 20.0;
	
	
	public Bat() {
		x = (Game.xdim -batWidth)/ 2.0;
		y = Game.ydim - 2*batHeight;
	}
	
	@Override
	void draw(Graphics g) {
		// TODO Auto-generated method stub
		g.setColor(new Color(0.1f,0.0f,1.0f));
		g.fillRect((int) x, (int) y, (int) batWidth, (int) batHeight);
	}

	@Override
	void step() {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseDragged(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseMoved(MouseEvent e) {
		// TODO Auto-generated method stub
		
		//System.out.println("mouseMove " + e.getX());
		x = e.getX();
		
	}
	
	
	public boolean hit(Ball ball) {
		return (x < ball.x) && (ball.x < x + batWidth) && (y < ball.y) && (ball.y < y + batHeight); 
	}

}

