• LaserMechs.cpp
  • #include "../Game.h"
    
    void Game::LaserCollusion() {
        for(auto& l : player_lasers) {
            for(auto& a : aliens) {
                if(l.location.Distance(a.location) < a.image.GetWidth()) {
                    points++;
                    score.Text = Gorgon::String::Concat("**Points:** ", points, " **Health:** ", health);
                    aliens.Remove(a);
                    player_lasers.Remove(l);
                    break;
                }
            }
        }
    }
    
    void Game::LaserMovement() {
        for(auto& ll : player_lasers) {
            ll.location.Y -= 5; 
            if(ll.location.Y <= 0) { player_lasers.Remove(ll); }
        }
        for(auto& ll : alien_lasers) {
            ll.location.Y += AlienVariables::laser_speed; 
            if(ll.location.Y >= 640) { alien_lasers.Remove(ll); }
        }
    }