\hypertarget{game_managers_8cpp_source}{}\doxysection{game\+Managers.\+cpp}
\label{game_managers_8cpp_source}\index{src/game/gameManagers.cpp@{src/game/gameManagers.cpp}}
\mbox{\hyperlink{game_managers_8cpp}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00001}00001 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00011}00011 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{game_8h}{game.h}}"{}}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00012}00012 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00013}\mbox{\hyperlink{game_managers_8cpp_a543c1a1b2d90a36ad8f512ae3107ce2a}{00013}} \textcolor{preprocessor}{\#define ISPRESSED(ID, X) window.isPressed(\{confData.playerDefs[ID].keys.X, false\})}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00014}00014 \textcolor{keywordtype}{void} Game::manageOnePlayer(\mbox{\hyperlink{utils_8h_a19f2f2312637b6ed67b6d24598b6f470}{playerID}} pID)\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00015}00015 \mbox{\hyperlink{struct_player}{Player}}\& p = players[pID];}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00016}00016 \textcolor{keywordflow}{if}(p.\mbox{\hyperlink{struct_player_a45bd873fbf46cb105cb038b51251a812}{hasDeathAnimation}}()) \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00017}00017 ++p.\mbox{\hyperlink{struct_player_a3f6353c84662c57d74aafa770773c409}{deathAnimCounter}};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00018}00018 \textcolor{keywordflow}{if} (p.\mbox{\hyperlink{struct_player_a3f6353c84662c57d74aafa770773c409}{deathAnimCounter}} == 75) \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00019}00019 p.\mbox{\hyperlink{struct_player_a3f6353c84662c57d74aafa770773c409}{deathAnimCounter}} = 0;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00020}00020 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00021}00021 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00022}00022 \textcolor{keywordflow}{if}(p.\mbox{\hyperlink{struct_player_a7aacef142ba14d6af7a6dfcb8ef327cd}{isEliminated}}())\textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00023}00023 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00024}00024 \textcolor{keywordflow}{if} (\mbox{\hyperlink{game_managers_8cpp_a543c1a1b2d90a36ad8f512ae3107ce2a}{ISPRESSED}}(pID, left))\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00025}00025 \textcolor{keywordflow}{if}(p.\mbox{\hyperlink{struct_player_a9edbd6fa228cf532b7a74fb45721c2e0}{x}} < confData.\mbox{\hyperlink{struct_config_data_a199264aa6e6c3b267462f0a5427cd5db}{playersSpeed}}) p.\mbox{\hyperlink{struct_player_a9edbd6fa228cf532b7a74fb45721c2e0}{x}} = 0;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00026}00026 \textcolor{keywordflow}{else} p.\mbox{\hyperlink{struct_player_a9edbd6fa228cf532b7a74fb45721c2e0}{x}} -\/= confData.\mbox{\hyperlink{struct_config_data_a199264aa6e6c3b267462f0a5427cd5db}{playersSpeed}};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00027}00027 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00028}00028 \textcolor{keywordflow}{if} (\mbox{\hyperlink{game_managers_8cpp_a543c1a1b2d90a36ad8f512ae3107ce2a}{ISPRESSED}}(pID, right))\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00029}00029 \textcolor{keywordflow}{if}(p.\mbox{\hyperlink{struct_player_a9edbd6fa228cf532b7a74fb45721c2e0}{x}} + confData.\mbox{\hyperlink{struct_config_data_ad8c5d2876699ea9e451e6b3a15618707}{playersWidth}} + confData.\mbox{\hyperlink{struct_config_data_a199264aa6e6c3b267462f0a5427cd5db}{playersSpeed}} >= pm-\/>getScreenWidth()) p.\mbox{\hyperlink{struct_player_a9edbd6fa228cf532b7a74fb45721c2e0}{x}} = pm-\/>getScreenWidth() -\/ confData.\mbox{\hyperlink{struct_config_data_ad8c5d2876699ea9e451e6b3a15618707}{playersWidth}} -\/ 1;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00030}00030 \textcolor{keywordflow}{else} p.\mbox{\hyperlink{struct_player_a9edbd6fa228cf532b7a74fb45721c2e0}{x}} += confData.\mbox{\hyperlink{struct_config_data_a199264aa6e6c3b267462f0a5427cd5db}{playersSpeed}};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00031}00031 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00032}00032 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00034}00034 \textcolor{keywordflow}{if}(!p.\mbox{\hyperlink{struct_player_a45bd873fbf46cb105cb038b51251a812}{hasDeathAnimation}}()) \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00035}00035 \textcolor{keywordflow}{if}(p.\mbox{\hyperlink{struct_player_a68ea5bd892a77c115baff824c526b3d2}{fireCooldown}}==0) \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00036}00036 \textcolor{keywordflow}{if} (\mbox{\hyperlink{game_managers_8cpp_a543c1a1b2d90a36ad8f512ae3107ce2a}{ISPRESSED}}(pID, shoot)) \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00037}00037 torpedos.emplace\_back(p.\mbox{\hyperlink{struct_player_a9edbd6fa228cf532b7a74fb45721c2e0}{x}} + confData.\mbox{\hyperlink{struct_config_data_ad8c5d2876699ea9e451e6b3a15618707}{playersWidth}} / 2, pm-\/>getScreenHeight() -\/ \mbox{\hyperlink{utils_8h_a2712b06fd52f25adca031d05c3e0c09b}{PLAYER\_HEIGHT}}, pID);}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00038}00038 p.\mbox{\hyperlink{struct_player_a68ea5bd892a77c115baff824c526b3d2}{fireCooldown}} = confData.\mbox{\hyperlink{struct_config_data_a641d7b2133165ce2eccaea972265f557}{playersFireCooldown}};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00039}00039 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00040}00040 \}\textcolor{keywordflow}{else} -\/-\/p.\mbox{\hyperlink{struct_player_a68ea5bd892a77c115baff824c526b3d2}{fireCooldown}};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00041}00041 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00042}00042 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00044}00044 \textcolor{keywordtype}{void} Game::managePlayers()\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00045}00045 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{unsigned} i=0;igetScreenWidth())\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00077}00077 baseInvPos.setX(baseInvPos.getX() + confData.\mbox{\hyperlink{struct_config_data_ad057123e1f1b7283b873eed8a07ead3f}{invadersSpeed}});}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00078}00078 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00079}00079 \textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00080}00080 baseInvPos.setY(baseInvPos.getY() + confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} + confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}});}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00081}00081 direction = !direction;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00082}00082 \textcolor{keywordflow}{return} \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00083}00083 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00084}00084 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00085}00085 \textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00086}00086 \textcolor{keywordtype}{size\_t} i = 0;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00087}00087 \textcolor{keywordtype}{unsigned} relativeBasePos = baseInvPos.getX();}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00088}00088 \textcolor{keywordflow}{while} (grid[i].hasNoValid())\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00089}00089 relativeBasePos += confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} + confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00090}00090 ++i;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00091}00091 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00092}00092 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00093}00093 \textcolor{keywordflow}{if}(relativeBasePos >= confData.\mbox{\hyperlink{struct_config_data_ad057123e1f1b7283b873eed8a07ead3f}{invadersSpeed}})\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00094}00094 baseInvPos.setX(baseInvPos.getX() -\/ confData.\mbox{\hyperlink{struct_config_data_ad057123e1f1b7283b873eed8a07ead3f}{invadersSpeed}});}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00095}00095 \}\textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00096}00096 baseInvPos.setY(baseInvPos.getY() + confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} + confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}});}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00097}00097 direction = !direction;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00098}00098 \textcolor{keywordflow}{return} \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00099}00099 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00100}00100 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00101}00101 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00102}00102 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00103}00103 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00104}00104 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00105}00105 \textcolor{keywordtype}{void} Game::remCollidingProjectiles()\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00107}00107 \textcolor{keyword}{auto} miss = missiles.begin();}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00108}00108 \textcolor{keyword}{auto} tor = torpedos.begin();}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00109}00109 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00110}00110 \textcolor{keywordflow}{while}(miss != missiles.end())\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00111}00111 \textcolor{keywordtype}{bool} wasColliding = \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00112}00112 \textcolor{keywordflow}{while}(tor != torpedos.end())\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00113}00113 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00114}00114 \textcolor{comment}{// missiles can't be right under torpedos, so that must means they are colliding in Y}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00115}00115 \textcolor{keywordflow}{if}(miss-\/>getY() + confData.\mbox{\hyperlink{struct_config_data_ae736dc72056f45f4a3f0fef365bc54be}{missilesLength}} < tor-\/>getY())\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00116}00116 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00117}00117 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00118}00118 \textcolor{keywordflow}{if}(\mbox{\hyperlink{utils_8h_a8d01e61a45fe7072e45f22044013e358}{areLinesColliding}}( \textcolor{comment}{// now check if they collide in X}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00119}00119 miss-\/>getX(), miss-\/>getX() + confData.\mbox{\hyperlink{struct_config_data_a4f8e7615d2619a3b37e97465ac143fee}{missilesWidth}},}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00120}00120 tor-\/>getX(), tor-\/>getX() + confData.\mbox{\hyperlink{struct_config_data_aec2b163d49271a1a1654c903de9e45ff}{torpedosWidth}}))\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00121}00121 missiles.erase(miss);}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00122}00122 torpedos.erase(tor);}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00123}00123 wasColliding = \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00124}00124 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00125}00125 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00126}00126 ++tor;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00127}00127 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00128}00128 \textcolor{comment}{/* if it was colling, it was removed and his Position is now replaced by the next.}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00129}00129 \textcolor{comment}{ * else, go to the next */}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00130}00130 \textcolor{keywordflow}{if}(!wasColliding)++miss;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00131}00131 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00132}00132 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00133}00133 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00134}00134 \textcolor{keywordtype}{void} Game::moveMissiles() \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00135}00135 \textcolor{keyword}{auto} miss = missiles.begin();}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00136}00136 \textcolor{keywordflow}{while} (miss != missiles.end()) \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00137}00137 \textcolor{keywordflow}{if} (miss-\/>getY() >= pm-\/>getScreenHeight())missiles.erase(miss);}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00138}00138 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00139}00139 miss-\/>setY(miss-\/>getY()+confData.\mbox{\hyperlink{struct_config_data_ae5efc1b5a2b95b1a9c7ff60eee480e71}{missilesSpeed}});}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00140}00140 ++miss;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00141}00141 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00142}00142 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00143}00143 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00144}00144 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00145}00145 \textcolor{keywordtype}{void} Game::moveTorpedos() \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00146}00146 \textcolor{keyword}{auto} tor = torpedos.begin();}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00147}00147 \textcolor{keywordflow}{while} (tor != torpedos.end()) \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00148}00148 \textcolor{keywordflow}{if} (tor-\/>getY()+confData.\mbox{\hyperlink{struct_config_data_a5de633401856c45fb3b8c3333d38804c}{torpedosLength}} <= 0)torpedos.erase(tor);}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00149}00149 \textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00150}00150 tor-\/>setY(tor-\/>getY()-\/confData.\mbox{\hyperlink{struct_config_data_aa491de435feeca58c85652f4961ddece}{torpedosSpeed}});}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00151}00151 ++tor;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00152}00152 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00153}00153 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00154}00154 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00155}00155 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00156}00156 \textcolor{keywordtype}{void} Game::checkMissilesAndPlayers() \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00157}00157 \textcolor{keyword}{auto} miss\_ite = missiles.begin();}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00158}00158 \textcolor{keywordflow}{while}(miss\_ite!=missiles.end())\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00159}00159 \textcolor{keywordtype}{bool} wasColliding = \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00160}00160 \textcolor{keywordflow}{if}(miss\_ite-\/>getY()>=pm-\/>getScreenHeight()-\/\mbox{\hyperlink{utils_8h_a2712b06fd52f25adca031d05c3e0c09b}{PLAYER\_HEIGHT}})\{ \textcolor{comment}{// check collision on Y}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00161}00161 \textcolor{comment}{// now check collision on X (with both players)}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00162}00162 \textcolor{keywordflow}{for}(\mbox{\hyperlink{struct_player}{Player}}\& p : players)\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00163}00163 \textcolor{keywordflow}{if}(p.isPlaying())\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00164}00164 \textcolor{keywordflow}{if}(\mbox{\hyperlink{utils_8h_a8d01e61a45fe7072e45f22044013e358}{areLinesColliding}}(}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00165}00165 miss\_ite-\/>getX(), miss\_ite-\/>getX() + confData.\mbox{\hyperlink{struct_config_data_a4f8e7615d2619a3b37e97465ac143fee}{missilesWidth}},}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00166}00166 p.x, p.x + confData.\mbox{\hyperlink{struct_config_data_ad8c5d2876699ea9e451e6b3a15618707}{playersWidth}}))\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00167}00167 wasColliding = \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00168}00168 p.damage();}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00169}00169 \textcolor{comment}{// do not break, the second player also deserves to be hit}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00170}00170 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00171}00171 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00172}00172 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00173}00173 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00174}00174 \textcolor{keywordflow}{if}(wasColliding)missiles.erase(miss\_ite);}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00175}00175 \textcolor{keywordflow}{else} ++miss\_ite;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00176}00176 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00177}00177 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00178}00178 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00179}00179 \textcolor{keywordtype}{bool} Game::checkTorpedosAndInvaders() \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00180}00180 \textcolor{keyword}{auto} tor\_ite = torpedos.begin();}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00181}00181 \textcolor{keywordflow}{while}(tor\_ite!=torpedos.end())\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00182}00182 \textcolor{keywordtype}{unsigned} i=0;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00183}00183 \textcolor{keywordflow}{for}(;i=tor\_ite-\/>getY() \&\&}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00194}00194 pos.getY()<=tor\_ite-\/>getY()+confData.\mbox{\hyperlink{struct_config_data_a5de633401856c45fb3b8c3333d38804c}{torpedosLength}})\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00195}00195 \textcolor{comment}{// now check collision on X}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00196}00196 \textcolor{keywordflow}{if}(\mbox{\hyperlink{utils_8h_a8d01e61a45fe7072e45f22044013e358}{areLinesColliding}}( \textcolor{comment}{// now check collision on X}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00197}00197 tor\_ite-\/>getX(), tor\_ite-\/>getX() + confData.\mbox{\hyperlink{struct_config_data_aec2b163d49271a1a1654c903de9e45ff}{torpedosWidth}},}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00198}00198 pos.getX(), pos.getX() + confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}}))\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00199}00199 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00200}00200 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00201}00201 \mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018}{InvaderType}} invType = grid[i][alienIndex];}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00202}00202 players[tor\_ite-\/>owner].score += confData.\mbox{\hyperlink{struct_config_data_af0c88560ab28fe51ef1743219633cfdc}{invadersDef}}.at(invType).points;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00203}00203 torpedos.erase(tor\_ite);}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00204}00204 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00205}00205 grid[i][alienIndex] = \mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018ab50339a10e1de285ac99d4c3990b8693}{InvaderType::NONE}};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00206}00206 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00207}00207 \textcolor{keywordflow}{if}(!areThereInvadersLeft()) \textcolor{keywordflow}{return} \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00208}00208 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00209}00209 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00210}00210 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00211}00211 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00212}00212 \textcolor{keywordflow}{if}(i==grid.size()) ++tor\_ite;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00213}00213 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00214}00214 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00215}00215 \}}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00216}00216 }
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00217}00217 \textcolor{keywordtype}{bool} Game::invadersTouchPlayer()\textcolor{keyword}{ const }\{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00218}00218 \textcolor{keywordflow}{return} any\_of(grid.begin(), grid.end(), [\textcolor{keyword}{this}](\textcolor{keyword}{const} \mbox{\hyperlink{class_invaders_column}{InvadersColumn}}\& line) -\/> \textcolor{keywordtype}{bool} \{}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00219}00219 unsigned outter = line.getOutterInvader();}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00220}00220 return this-\/>baseInvPos.getY() + confData.invadersSize * (outter + 1)}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00221}00221 +confData.invadersDistance*outter}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00222}00222 >= pm-\/>getScreenHeight() -\/ PLAYER\_HEIGHT;}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00223}00223 \});}
\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00224}00224 \}}
\end{DoxyCode}