package holo.bolt.entity;

public class Hitbox
{
	public float[] pos;
	public float[] size;
	
	public Hitbox(float[] position, float[] size)
	{
		pos = position;
		this.size = size;
	}
	
	public void move(float[] difference)
	{
		pos[0] = difference[0];
		pos[1] = difference[1];
	}
	
	public boolean isIntersecting(Hitbox box)
	{
		if(((box.pos[0] > this.pos[0] && box.pos[0] < this.pos[0] + this.size[0]) || (this.pos[0] > box.pos[0] && this.pos[0] < box.pos[0] + box.size[0]))
				&&((box.pos[1] > this.pos[1] && box.pos[1] < this.pos[1] + this.size[1]) || (this.pos[1] > box.pos[1] && this.pos[1] < box.pos[1] + box.size[1])))
			return true;
		else return false;
	}
	
	public Hitbox copy()
	{
		return new Hitbox(this.pos, this.size);
	}
}
