package objects;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;

public class Missile {
	private Rectangle rect;
	int dir;
	public Missile(int x, int y, int dir){
		rect = new Rectangle(x, y,6,20);
		this.dir = dir;
	}
	public void draw(Graphics2D g2){
		g2.setColor(Color.white);
		g2.fill(rect);
	}
	public void recalculate(){
		rect.setLocation((int)rect.getX(), (int)(rect.getY() + 10*dir));
	}
	public boolean playerCollision(Player player){
		return rect.intersects(player.getBorder());
	}
	public boolean outOfScreen(int x, int y, int w, int h){
		return !rect.intersects(x, y, w, h);
	}
}
