using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BloomTest
{
    class Lazer
    {                
        public Color color = Color.White;
        public Vector2 pos, vel, scale;
        public float rot;
        public float radius; //for collision detect
        public bool expired;        
        public Lazer(Vector2 position, Vector2 velocity) //create a lazer
        {
            pos = position;    vel = velocity;    scale = Vector2.One;
            rot = (float)Math.Atan2(vel.Y, vel.X);
            radius = 8; 
            expired = false;
        }
        public void Update(Vector2 world_vel)
        {
            if (vel.LengthSquared() > 0) rot = (float)Math.Atan2(vel.Y, vel.X); //if is moving, set its' rot angle
            pos += vel; pos -= world_vel;
            // delete lazers that go off-screen            
            if ((pos.X < -32-1000) || (pos.Y < -32-1000) || (pos.X > Game1.screenW+1000) || (pos.Y > Game1.screenH+1000)) {
                expired = true;                
            }
        }
    }
}
