package bullithell.objects.missiles;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.RadialGradientPaint;
import java.awt.Rectangle;

public class PlayerMissile extends Missile {
	private Rectangle background;
	
	public PlayerMissile(int x, int y, int speed){
		this.setBorder(new Rectangle(x, y,3,20));
		this.background = new Rectangle(x-20, y-20, 30, 40);
		this.setYspeed(speed*-1);
		this.setXspeed(0);
		this.type = Missile.Missiletype.LASER;
	}
	public void draw(Graphics2D g2){
		super.draw(g2);
		g2.setPaint(new RadialGradientPaint(new Point((int)(getBorder().getX() + getBorder().getWidth()/2),(int)(getBorder().getY() + getBorder().getHeight()/2)), (int)(background.getHeight()/2), new float[]{0f,0.6f}, new Color[]{Color.WHITE,new Color(0,0,0,0)}));
		g2.fill(background);
		g2.setPaint(new GradientPaint(new Point((int)getBorder().getX(),(int)getBorder().getY()), Color.WHITE, new Point((int)getBorder().getMaxX(),(int)getBorder().getMaxY()), new Color(190,190,190,100)));
		g2.fill(getBorder());
	}
	public void recalculate(){
		super.recalculate();
		background.setLocation((int)(getBorder().getX() - 15), (int)(getBorder().getY()-15));
	}

}
