• PlayerMechs.cpp
  • #include "../Game.h"
    #include <Gorgon/Geometry/Point.h>
    
    void Game::PlayerMech() {
        for(auto& key : keypress) {
            key.DoIfPressed();
        }
    }
    
    void Game::PlayerCollusion() {
        for(auto& a : aliens) {
            if(player.location.Distance(a.location) < a.image.GetWidth()) {
                health--;
                score.Text = Gorgon::String::Concat("**Points:** ", points, " **Health:** ", health);
                aliens.Remove(a);
            }
        }
        for(auto& al : alien_lasers) {
            Point location = {player.location.X + player.image.GetWidth() / 2,  player.location.Y + player.image.GetHeight() / 2}; 
            if(al.location.Distance(location) <= 50) {
                health--;
                score.Text = Gorgon::String::Concat("**Points:** ", points, " **Health:** ", health);
                alien_lasers.Remove(al);
            }
            break;
        }
    }