//lasers.cpp                   //contains update functions, reassigns ammo to proper objects etc
#include <allegro.h>
#include "classes.h"
#include "globals.h"
#include "collisions.h"

laser::laser(int xx, int yy, int dd){
    x = xx;
    tx = xx;
    y = yy;
    ty = yy;
    dir = dd;}
    
void handle_las(){
    int dis; //to track distance traveled
    //this loop handle laser updating
    for (int c1 = 0; c1<las.size(); c1++){
        dis = abs( sqrt( sqrd(las[c1].x-las[c1].tx) + sqrd(las[c1].y-las[c1].ty)));
        if (dis>500)
        las.erase(las.begin()+c1);
        else
        las[c1].change_xy(las[c1].dir, 2);}}
