diff --git a/doc/SAE102-SpaceInvaders/html/d1/de4/game_managers_8cpp_source.html b/doc/SAE102-SpaceInvaders/html/d1/de4/game_managers_8cpp_source.html index e09baba..cba5ef6 100644 --- a/doc/SAE102-SpaceInvaders/html/d1/de4/game_managers_8cpp_source.html +++ b/doc/SAE102-SpaceInvaders/html/d1/de4/game_managers_8cpp_source.html @@ -135,7 +135,7 @@ $(document).ready(function(){initNavTree('d1/de4/game_managers_8cpp_source.html'
55
56 unsigned rdCol = grid.randomValidCol();
57 // fire !
-
58 missiles.push_back(basePos + Position(
+
58 missiles.push_back(baseInvPos + Position(
59 confData.invadersSize * rdCol + confData.invadersDistance * (rdCol + 0.5),
60 confData.invadersSize * (grid[rdCol].size() - 1) + confData.invadersDistance * (grid[rdCol].size() - 1)
61 ));
@@ -145,7 +145,7 @@ $(document).ready(function(){initNavTree('d1/de4/game_managers_8cpp_source.html'
65 // TODO fix this lol
66
67 if(direction){ // go to the right
-
68 int end = basePos.getX(); // start Position
+
68 int end = baseInvPos.getX(); // start Position
69 end+= grid.size() * confData.invadersSize; // add the invaders
70 end+= (grid.size()-1) * confData.invadersDistance; // add the invadersDistance between invaders
71
@@ -158,26 +158,26 @@ $(document).ready(function(){initNavTree('d1/de4/game_managers_8cpp_source.html'
78 }
79
80 if(end + confData.invadersSpeed < relativeScreenWidth){
-
81 basePos.setX(basePos.getX() + confData.invadersSpeed);
+
81 baseInvPos.setX(baseInvPos.getX() + confData.invadersSpeed);
82 }
83 else{
-
84 basePos.setY(basePos.getY() + confData.invadersSize + confData.invadersDistance);
+
84 baseInvPos.setY(baseInvPos.getY() + confData.invadersSize + confData.invadersDistance);
85 direction = !direction;
86 return true;
87 }
88 }
89 else{
90 size_t i = 0;
-
91 unsigned relativeBasePos = basePos.getX();
+
91 unsigned relativeBasePos = baseInvPos.getX();
92 while (grid[i].hasNoValid()){
93 relativeBasePos += confData.invadersSize + confData.invadersDistance;
94 ++i;
95 }
96
97 if(relativeBasePos >= confData.invadersSpeed){
-
98 basePos.setX(basePos.getX() - confData.invadersSpeed);
+
98 baseInvPos.setX(baseInvPos.getX() - confData.invadersSpeed);
99 }else{
-
100 basePos.setY(basePos.getY() + confData.invadersSize + confData.invadersDistance);
+
100 baseInvPos.setY(baseInvPos.getY() + confData.invadersSize + confData.invadersDistance);
101 direction = !direction;
102 return true;
103 }
@@ -269,7 +269,7 @@ $(document).ready(function(){initNavTree('d1/de4/game_managers_8cpp_source.html'
189 unsigned alienIndex = grid[i].getOutterInvader();
190 if(alienIndex==grid[i].size())continue;
191 // calculate top-left Position of invader
-
192 Position pos = basePos + Position(
+
192 Position pos = baseInvPos + Position(
193 confData.invadersSize*i+confData.invadersDistance*i,
194 confData.invadersSize*alienIndex+confData.invadersDistance*alienIndex
195 );
@@ -301,7 +301,7 @@ $(document).ready(function(){initNavTree('d1/de4/game_managers_8cpp_source.html'
221bool Game::invadersTouchPlayer() const {
222 return any_of(grid.begin(), grid.end(), [this](const InvadersColumn& line) -> bool {
223 unsigned outter = line.getOutterInvader();
-
224 return this->basePos.getY()+confData.invadersSize*(outter+1)
+
224 return this->baseInvPos.getY()+confData.invadersSize*(outter+1)
225 +confData.invadersDistance*outter
226 >= pm->getScreenHeight() - PLAYER_HEIGHT;
227 });
diff --git a/doc/SAE102-SpaceInvaders/html/d2/dd5/game_8h_source.html b/doc/SAE102-SpaceInvaders/html/d2/dd5/game_8h_source.html index b5417a2..f0d09c7 100644 --- a/doc/SAE102-SpaceInvaders/html/d2/dd5/game_8h_source.html +++ b/doc/SAE102-SpaceInvaders/html/d2/dd5/game_8h_source.html @@ -118,7 +118,7 @@ $(document).ready(function(){initNavTree('d2/dd5/game_8h_source.html','../../');
57
61 God god;
62
-
66 Position basePos;
+
66 Position baseInvPos;
67
71 InvadersGrid grid;
72
@@ -154,7 +154,7 @@ $(document).ready(function(){initNavTree('d2/dd5/game_8h_source.html','../../');
147
152 void displayGod() const;
153
-
160 void displayInvader(const Position& basePos, InvaderType type) const;
+
160 void displayInvader(const Position& baseInvPos, InvaderType type) const;
161
166 void displayHearts(playerID) const;
167
diff --git a/doc/SAE102-SpaceInvaders/html/d9/d15/god_manager_8cpp_source.html b/doc/SAE102-SpaceInvaders/html/d9/d15/god_manager_8cpp_source.html index 862451b..eb28c9e 100644 --- a/doc/SAE102-SpaceInvaders/html/d9/d15/god_manager_8cpp_source.html +++ b/doc/SAE102-SpaceInvaders/html/d9/d15/god_manager_8cpp_source.html @@ -91,7 +91,7 @@ $(document).ready(function(){initNavTree('d9/d15/god_manager_8cpp_source.html','
11#include "game.h"
12
13void Game::tryAwakeGod() {
-
14 if (basePos.getY() > 100 /*lambda value*/ && god.state==GodState::NONE) {
+
14 if (baseInvPos.getY() > 100 /*lambda value*/ && god.state==GodState::NONE) {
15 god.counter = 0;
16 god.state = GodState::AWAKE;
17 }
@@ -125,7 +125,7 @@ $(document).ready(function(){initNavTree('d9/d15/god_manager_8cpp_source.html','
49 god.thrownInvType = InvaderType::NONE;
50
51 god.thrownTransition.setX(pm->getScreenWidth() - GOD_HAND_DISTANCE - GOD_HAND_SIZE);
-
52 god.thrownTransition.setY(basePos.getY() + INV_GET_POS(god.thrownInvPosY));
+
52 god.thrownTransition.setY(baseInvPos.getY() + INV_GET_POS(god.thrownInvPosY));
53 return false;
54 }
55 case GodState::RETRIEVE1: {
diff --git a/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp_source.html b/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp_source.html index 38bb30d..0a0daaf 100644 --- a/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp_source.html +++ b/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp_source.html @@ -96,8 +96,8 @@ $(document).ready(function(){initNavTree('db/d86/display_8cpp_source.html','../.
20 for (unsigned i = 0; i < this->grid.size(); ++i){
21 for (unsigned j = 0; j < this->grid[i].size(); ++j){
22 Position vec(
-
23 basePos.getX() + i * confData.invadersSize + i * confData.invadersDistance,
-
24 basePos.getY() + j * confData.invadersSize + j * confData.invadersDistance
+
23 baseInvPos.getX() + i * confData.invadersSize + i * confData.invadersDistance,
+
24 baseInvPos.getY() + j * confData.invadersSize + j * confData.invadersDistance
25 );
26 displayInvader(vec, grid[i][j]);
27 }
diff --git a/doc/SAE102-SpaceInvaders/html/de/db0/game_basics_8cpp_source.html b/doc/SAE102-SpaceInvaders/html/de/db0/game_basics_8cpp_source.html index a47cf97..fb5e63e 100644 --- a/doc/SAE102-SpaceInvaders/html/de/db0/game_basics_8cpp_source.html +++ b/doc/SAE102-SpaceInvaders/html/de/db0/game_basics_8cpp_source.html @@ -184,7 +184,7 @@ $(document).ready(function(){initNavTree('de/db0/game_basics_8cpp_source.html','
105 players[i].lives = confData.playersLives;
106 }
107
-
108 basePos = Position(200, 0);
+
108 baseInvPos = Position(200, 0);
109 direction = true;
110
111}
@@ -249,7 +249,7 @@ $(document).ready(function(){initNavTree('de/db0/game_basics_8cpp_source.html','
170}
171
172Position Game::invIndexToPos(unsigned x, unsigned y) const {
-
173 return basePos+Position(INV_GET_POS(x), INV_GET_POS(y));
+
173 return baseInvPos+Position(INV_GET_POS(x), INV_GET_POS(y));
174}
175
176bool Game::arePlayersDead() {
diff --git a/doc/SAE102-SpaceInvaders/latex/d1/de4/game_managers_8cpp_source.tex b/doc/SAE102-SpaceInvaders/latex/d1/de4/game_managers_8cpp_source.tex index 25ffbc4..c05ae57 100644 --- a/doc/SAE102-SpaceInvaders/latex/d1/de4/game_managers_8cpp_source.tex +++ b/doc/SAE102-SpaceInvaders/latex/d1/de4/game_managers_8cpp_source.tex @@ -50,7 +50,7 @@ \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00055}00055 } \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00056}00056 \textcolor{keywordtype}{unsigned} rdCol = grid.\mbox{\hyperlink{class_invaders_grid_ac184c30c8a60fdbe8abed9b9455d35d2}{randomValidCol}}();} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00057}00057 \textcolor{comment}{// fire !}} -\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00058}00058 missiles.push\_back(basePos + \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(} +\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00058}00058 missiles.push\_back(baseInvPos + \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00059}00059 confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} * rdCol + confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}} * (rdCol + 0.5),} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00060}00060 confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} * (grid[rdCol].size() -\/ 1) + confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}} * (grid[rdCol].size() -\/ 1)} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00061}00061 ));} @@ -60,7 +60,7 @@ \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00065}00065 \textcolor{comment}{// TODO fix this lol}} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00066}00066 } \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00067}00067 \textcolor{keywordflow}{if}(direction)\{ \textcolor{comment}{// go to the right}} -\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00068}00068 \textcolor{keywordtype}{int} end = basePos.getX(); \textcolor{comment}{// start Position}} +\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00068}00068 \textcolor{keywordtype}{int} end = baseInvPos.getX(); \textcolor{comment}{// start Position}} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00069}00069 end+= grid.size() * confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}}; \textcolor{comment}{// add the invaders}} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00070}00070 end+= (grid.size()-\/1) * confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}}; \textcolor{comment}{// add the invadersDistance between invaders}} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00071}00071 } @@ -73,26 +73,26 @@ \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00078}00078 \}} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00079}00079 } \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00080}00080 \textcolor{keywordflow}{if}(end + confData.\mbox{\hyperlink{struct_config_data_ad057123e1f1b7283b873eed8a07ead3f}{invadersSpeed}} < relativeScreenWidth)\{} -\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00081}00081 basePos.setX(basePos.getX() + confData.\mbox{\hyperlink{struct_config_data_ad057123e1f1b7283b873eed8a07ead3f}{invadersSpeed}});} +\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00081}00081 baseInvPos.setX(baseInvPos.getX() + confData.\mbox{\hyperlink{struct_config_data_ad057123e1f1b7283b873eed8a07ead3f}{invadersSpeed}});} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00082}00082 \}} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00083}00083 \textcolor{keywordflow}{else}\{} -\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00084}00084 basePos.setY(basePos.getY() + confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} + confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}});} +\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00084}00084 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_l00085}00085 direction = !direction;} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00086}00086 \textcolor{keywordflow}{return} \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00087}00087 \}} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00088}00088 \}} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00089}00089 \textcolor{keywordflow}{else}\{} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00090}00090 \textcolor{keywordtype}{size\_t} i = 0;} -\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00091}00091 \textcolor{keywordtype}{unsigned} relativeBasePos = basePos.getX();} +\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00091}00091 \textcolor{keywordtype}{unsigned} relativeBasePos = baseInvPos.getX();} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00092}00092 \textcolor{keywordflow}{while} (grid[i].hasNoValid())\{} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00093}00093 relativeBasePos += confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} + confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}};} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00094}00094 ++i;} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00095}00095 \}} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00096}00096 } \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00097}00097 \textcolor{keywordflow}{if}(relativeBasePos >= confData.\mbox{\hyperlink{struct_config_data_ad057123e1f1b7283b873eed8a07ead3f}{invadersSpeed}})\{} -\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00098}00098 basePos.setX(basePos.getX() -\/ confData.\mbox{\hyperlink{struct_config_data_ad057123e1f1b7283b873eed8a07ead3f}{invadersSpeed}});} +\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00098}00098 baseInvPos.setX(baseInvPos.getX() -\/ confData.\mbox{\hyperlink{struct_config_data_ad057123e1f1b7283b873eed8a07ead3f}{invadersSpeed}});} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00099}00099 \}\textcolor{keywordflow}{else}\{} -\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00100}00100 basePos.setY(basePos.getY() + confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} + confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}});} +\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00100}00100 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_l00101}00101 direction = !direction;} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00102}00102 \textcolor{keywordflow}{return} \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00103}00103 \}} @@ -184,7 +184,7 @@ \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00189}00189 \textcolor{keywordtype}{unsigned} alienIndex = grid[i].getOutterInvader();} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00190}00190 \textcolor{keywordflow}{if}(alienIndex==grid[i].size())\textcolor{keywordflow}{continue};} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00191}00191 \textcolor{comment}{// calculate top-\/left Position of invader}} -\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00192}00192 \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} pos = basePos + \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(} +\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00192}00192 \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} pos = baseInvPos + \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00193}00193 confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}}*i+confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}}*i,} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00194}00194 confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}}*alienIndex+confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}}*alienIndex} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00195}00195 );} @@ -216,7 +216,7 @@ \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00221}00221 \textcolor{keywordtype}{bool} Game::invadersTouchPlayer()\textcolor{keyword}{ const }\{} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00222}00222 \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_l00223}00223 unsigned outter = line.getOutterInvader();} -\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00224}00224 return this-\/>basePos.getY()+confData.invadersSize*(outter+1)} +\DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00224}00224 return this-\/>baseInvPos.getY()+confData.invadersSize*(outter+1)} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00225}00225 +confData.invadersDistance*outter} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00226}00226 >= pm-\/>getScreenHeight() -\/ PLAYER\_HEIGHT;} \DoxyCodeLine{\Hypertarget{game_managers_8cpp_source_l00227}00227 \});} diff --git a/doc/SAE102-SpaceInvaders/latex/d2/dd5/game_8h_source.tex b/doc/SAE102-SpaceInvaders/latex/d2/dd5/game_8h_source.tex index e4654c7..faff6b8 100644 --- a/doc/SAE102-SpaceInvaders/latex/d2/dd5/game_8h_source.tex +++ b/doc/SAE102-SpaceInvaders/latex/d2/dd5/game_8h_source.tex @@ -33,7 +33,7 @@ \DoxyCodeLine{\Hypertarget{game_8h_source_l00057}00057 } \DoxyCodeLine{\Hypertarget{game_8h_source_l00061}00061 \mbox{\hyperlink{class_god}{God}} god;} \DoxyCodeLine{\Hypertarget{game_8h_source_l00062}00062 } -\DoxyCodeLine{\Hypertarget{game_8h_source_l00066}00066 \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} basePos;} +\DoxyCodeLine{\Hypertarget{game_8h_source_l00066}00066 \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} baseInvPos;} \DoxyCodeLine{\Hypertarget{game_8h_source_l00067}00067 } \DoxyCodeLine{\Hypertarget{game_8h_source_l00071}00071 \mbox{\hyperlink{class_invaders_grid}{InvadersGrid}} grid;} \DoxyCodeLine{\Hypertarget{game_8h_source_l00072}00072 } @@ -69,7 +69,7 @@ \DoxyCodeLine{\Hypertarget{game_8h_source_l00147}00147 } \DoxyCodeLine{\Hypertarget{game_8h_source_l00152}00152 \textcolor{keywordtype}{void} displayGod() \textcolor{keyword}{const};} \DoxyCodeLine{\Hypertarget{game_8h_source_l00153}00153 } -\DoxyCodeLine{\Hypertarget{game_8h_source_l00160}00160 \textcolor{keywordtype}{void} displayInvader(\textcolor{keyword}{const} \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}\& basePos, \mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018}{InvaderType}} type) \textcolor{keyword}{const};} +\DoxyCodeLine{\Hypertarget{game_8h_source_l00160}00160 \textcolor{keywordtype}{void} displayInvader(\textcolor{keyword}{const} \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}\& baseInvPos, \mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018}{InvaderType}} type) \textcolor{keyword}{const};} \DoxyCodeLine{\Hypertarget{game_8h_source_l00161}00161 } \DoxyCodeLine{\Hypertarget{game_8h_source_l00166}00166 \textcolor{keywordtype}{void} displayHearts(\mbox{\hyperlink{utils_8h_a19f2f2312637b6ed67b6d24598b6f470}{playerID}}) \textcolor{keyword}{const};} \DoxyCodeLine{\Hypertarget{game_8h_source_l00167}00167 } diff --git a/doc/SAE102-SpaceInvaders/latex/d9/d15/god_manager_8cpp_source.tex b/doc/SAE102-SpaceInvaders/latex/d9/d15/god_manager_8cpp_source.tex index 9ae8a84..e69b01a 100644 --- a/doc/SAE102-SpaceInvaders/latex/d9/d15/god_manager_8cpp_source.tex +++ b/doc/SAE102-SpaceInvaders/latex/d9/d15/god_manager_8cpp_source.tex @@ -6,7 +6,7 @@ \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00011}00011 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{game_8h}{game.h}}"{}}} \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00012}00012 } \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00013}00013 \textcolor{keywordtype}{void} Game::tryAwakeGod() \{} -\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00014}00014 \textcolor{keywordflow}{if} (basePos.getY() > 100 \textcolor{comment}{/*lambda value*/} \&\& god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}}==\mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355ab50339a10e1de285ac99d4c3990b8693}{GodState::NONE}}) \{} +\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00014}00014 \textcolor{keywordflow}{if} (baseInvPos.getY() > 100 \textcolor{comment}{/*lambda value*/} \&\& god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}}==\mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355ab50339a10e1de285ac99d4c3990b8693}{GodState::NONE}}) \{} \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00015}00015 god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} = 0;} \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00016}00016 god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}} = \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355afca549f3541c801906abc34b45e8953e}{GodState::AWAKE}};} \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00017}00017 \}} @@ -40,7 +40,7 @@ \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00049}00049 god.\mbox{\hyperlink{class_god_ad41071cd3e9f51419411e4fd1a0c63c5}{thrownInvType}} = \mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018ab50339a10e1de285ac99d4c3990b8693}{InvaderType::NONE}};} \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00050}00050 } \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00051}00051 god.\mbox{\hyperlink{class_god_a41b9ceec78e403a54cf8afaf6e50519a}{thrownTransition}}.setX(pm-\/>getScreenWidth() -\/ \mbox{\hyperlink{god_8h_a0b3ad1c15e80936f3ee35f4ff91f243c}{GOD\_HAND\_DISTANCE}} -\/ \mbox{\hyperlink{god_8h_a59e44f12d6c2f40c10bb249db0a3b3d6}{GOD\_HAND\_SIZE}});} -\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00052}00052 god.\mbox{\hyperlink{class_god_a41b9ceec78e403a54cf8afaf6e50519a}{thrownTransition}}.setY(basePos.getY() + \mbox{\hyperlink{utils_8h_a815cc3532f834befd1c85e0e8d3bc9f7}{INV\_GET\_POS}}(god.\mbox{\hyperlink{class_god_a26fbb775dff480eaa6a19d4a3ef9731c}{thrownInvPosY}}));} +\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00052}00052 god.\mbox{\hyperlink{class_god_a41b9ceec78e403a54cf8afaf6e50519a}{thrownTransition}}.setY(baseInvPos.getY() + \mbox{\hyperlink{utils_8h_a815cc3532f834befd1c85e0e8d3bc9f7}{INV\_GET\_POS}}(god.\mbox{\hyperlink{class_god_a26fbb775dff480eaa6a19d4a3ef9731c}{thrownInvPosY}}));} \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00053}00053 \textcolor{keywordflow}{return} \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00054}00054 \}} \DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00055}00055 \textcolor{keywordflow}{case} \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355a478d22fab8e360f3af57895f113f1f0f}{GodState::RETRIEVE1}}: \{} diff --git a/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp_source.tex b/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp_source.tex index 59ada13..5991dbf 100644 --- a/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp_source.tex +++ b/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp_source.tex @@ -11,8 +11,8 @@ \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00020}00020 \textcolor{keywordflow}{for} (\textcolor{keywordtype}{unsigned} i = 0; i < this-\/>grid.size(); ++i)\{} \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00021}00021 \textcolor{keywordflow}{for} (\textcolor{keywordtype}{unsigned} j = 0; j < this-\/>grid[i].size(); ++j)\{} \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00022}00022 \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} vec(} -\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00023}00023 basePos.getX() + i * confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} + i * confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}},} -\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00024}00024 basePos.getY() + j * confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} + j * confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}}} +\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00023}00023 baseInvPos.getX() + i * confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} + i * confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}},} +\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00024}00024 baseInvPos.getY() + j * confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} + j * confData.\mbox{\hyperlink{struct_config_data_aadc245edaf3b28d82f9ce7b17c655943}{invadersDistance}}} \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00025}00025 );} \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00026}00026 displayInvader(vec, grid[i][j]);} \DoxyCodeLine{\Hypertarget{display_8cpp_source_l00027}00027 \}} diff --git a/doc/SAE102-SpaceInvaders/latex/de/db0/game_basics_8cpp_source.tex b/doc/SAE102-SpaceInvaders/latex/de/db0/game_basics_8cpp_source.tex index f5646ea..e8c2b18 100644 --- a/doc/SAE102-SpaceInvaders/latex/de/db0/game_basics_8cpp_source.tex +++ b/doc/SAE102-SpaceInvaders/latex/de/db0/game_basics_8cpp_source.tex @@ -99,7 +99,7 @@ \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00105}00105 players[i].lives = confData.\mbox{\hyperlink{struct_config_data_a09170415d0a4c525e546d6fd0ecb354c}{playersLives}};} \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00106}00106 \}} \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00107}00107 } -\DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00108}00108 basePos = \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(200, 0);} +\DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00108}00108 baseInvPos = \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(200, 0);} \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00109}00109 direction = \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00110}00110 } \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00111}00111 \}} @@ -164,7 +164,7 @@ \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00170}00170 \}} \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00171}00171 } \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00172}00172 \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} Game::invIndexToPos(\textcolor{keywordtype}{unsigned} x, \textcolor{keywordtype}{unsigned} y)\textcolor{keyword}{ const }\{} -\DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00173}00173 \textcolor{keywordflow}{return} basePos+\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(\mbox{\hyperlink{utils_8h_a815cc3532f834befd1c85e0e8d3bc9f7}{INV\_GET\_POS}}(x), \mbox{\hyperlink{utils_8h_a815cc3532f834befd1c85e0e8d3bc9f7}{INV\_GET\_POS}}(y));} +\DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00173}00173 \textcolor{keywordflow}{return} baseInvPos+\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(\mbox{\hyperlink{utils_8h_a815cc3532f834befd1c85e0e8d3bc9f7}{INV\_GET\_POS}}(x), \mbox{\hyperlink{utils_8h_a815cc3532f834befd1c85e0e8d3bc9f7}{INV\_GET\_POS}}(y));} \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00174}00174 \}} \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00175}00175 } \DoxyCodeLine{\Hypertarget{game_basics_8cpp_source_l00176}\mbox{\hyperlink{class_game_aef8202b79983c3b0f8d6db6c01d17fa6}{00176}} \textcolor{keywordtype}{bool} \mbox{\hyperlink{class_game_aef8202b79983c3b0f8d6db6c01d17fa6}{Game::arePlayersDead}}() \{} diff --git a/headers/configData.h b/headers/configData.h index 39763cd..60988cd 100644 --- a/headers/configData.h +++ b/headers/configData.h @@ -67,7 +67,7 @@ struct ConfigData { unsigned playersLives; /*! - * @brief player key configuration + * @brief players configuration */ vector playerDefs; @@ -102,7 +102,7 @@ struct ConfigData { unsigned missilesWidth; /*! - * @brief invaders missiles length in pixel - auto defined from width + * @brief virtual value : invaders missiles length in pixel - auto defined from width */ unsigned missilesLength; @@ -122,7 +122,7 @@ struct ConfigData { unsigned torpedosWidth; /*! - * @brief players torpedos length in pixel // auto defined from width + * @brief virtual value : players torpedos length in pixel - auto defined from width */ unsigned torpedosLength; diff --git a/headers/errors.h b/headers/errors.h index f900184..7806f85 100644 --- a/headers/errors.h +++ b/headers/errors.h @@ -16,7 +16,10 @@ using namespace std; -// We keep the same case +/*! + * @class config_error + * @brief Simple clone of runtime_error to help us handle errors in config management. + */ class config_error : public runtime_error { public: explicit config_error(const string& msg); diff --git a/headers/game.h b/headers/game.h index b6707c2..9e9f206 100644 --- a/headers/game.h +++ b/headers/game.h @@ -61,9 +61,9 @@ private: God god; /*! - * @brief base position for game display + * @brief base position for the invader crowd */ - Position basePos; + Position baseInvPos; /*! * @brief Invader position and type matrix @@ -71,17 +71,17 @@ private: InvadersGrid grid; /*! - * @brief Invader scroll direction - True = right , False = left + * @brief Invader scroll direction - true = right , false = left */ bool direction; /*! - * @brief list of postion of all missiles shot by the invaders + * @brief list of positions of all missiles shot by the invaders */ vector missiles; /*! - * @brief list of postion of all torpedos shot by the player(s) + * @brief list of positions of all torpedoes shot by the player(s) */ vector torpedos; @@ -105,8 +105,8 @@ private: // basic methods /*! - * @brief - * @return true if there are no more invaders in the grid + * @brief check if there are invaders left in the grid + * @return true if there are no more invaders in the grid, else false * @fn bool updateColumns(); */ bool areThereInvadersLeft(); @@ -125,13 +125,7 @@ private: * @fn Position invIndexToPos(unsigned x, unsigned y) const; */ Position invIndexToPos(unsigned x, unsigned y) const; - - /*! - * @brief display players score on the screen - * @fn void displayScore(); - */ - void displayScore() const; - + /*! * @brief main display function, clear the window and calls sub display functions * @param[in] fps : current screen refresh rate @@ -149,7 +143,7 @@ private: * @brief display a singular invader * @param[in] basePos : invader's pixel coordinates * @param[in] type : invader's type - * @fn void displayInvader(const Position& basePos, InvaderType type) const + * @fn void displayInvader(const Position& baseInvPos, InvaderType type) const */ void displayInvader(const Position& basePos, InvaderType type) const; @@ -163,14 +157,14 @@ private: // managers /*! - * @brief Calls the function 'ManageOnePlayer' for all players in player list + * @brief Calls the function 'manageOnePlayer' for all players in player list * @fn void managePlayers(); */ void managePlayers(); /*! - * @brief Handles a player keystrokes, makes them move or make them shoot a torpedo - * @param[in] pID : Player id + * @brief Handles a player keystrokes, makes them move and shoot a torpedo + * @param[in] pID : Player id to manage * @fn void manageOnePlayer(playerID pID); */ void manageOnePlayer(playerID pID); @@ -210,14 +204,14 @@ private: /*! * @brief check if a torpedo collides with an invader - * @return true if there is a collision, false elsewise + * @return true if there is a collision, false otherwise * @fn bool checkTorpedosAndInvaders(); */ bool checkTorpedosAndInvaders(); /*! - * @brief check if the invaders have reach the players - * @return true if they have reach the player, false elsewise + * @brief check if the invaders have reached the players + * @return true if they have reached the player, false otherwise * @fn bool invadersTouchPlayer() const; */ bool invadersTouchPlayer() const; @@ -230,7 +224,7 @@ private: /*! * @brief make god behave - * @return true if theres no invader left, false elsewise + * @return true if theres no invader left, false otherwise * @fn bool manageGod(); */ bool manageGod(); @@ -257,16 +251,16 @@ public: void initGame(); /*! - * @brief enter the main gameplay game loop + * @brief enter the main gameplay game loop. Will block until the game ends * @return the value of the winners can be the players, the invaders or god * @fn WinValue enterGameLoop(); */ WinValue enterGameLoop(); /*! - * @brief reload the configuration file for a new game - * @return false if an error occured, true elsewise - * @fn bool reloadConfig(); + * @brief reload the configuration file (not dynamically used currently, but it was planned to be) + * @return false if an error occurred, true otherwise + * @fn bool reloadConfig(); */ bool reloadConfig(); diff --git a/headers/god.h b/headers/god.h index 57ff782..277c7e3 100644 --- a/headers/god.h +++ b/headers/god.h @@ -53,7 +53,7 @@ public: GodState state; /*! - * @brief manage all sorts of things, gods secrets remains unknown + * @brief timer used differently in all states */ unsigned counter; diff --git a/headers/invadersGrid.h b/headers/invadersGrid.h index f6d23ed..3ef34ce 100644 --- a/headers/invadersGrid.h +++ b/headers/invadersGrid.h @@ -32,11 +32,9 @@ enum class InvaderType { */ class InvadersColumn : public vector{ public: - // idk why CLion says this is not implemented, but it is - /*! * @brief tells if the column contains no non type NONE invader - * @return True if there's only type NONE invader, False elsewise + * @return True if there's only type NONE invader, False otherwise * @fn bool hasNoValid() const; */ bool hasNoValid() const; diff --git a/src/game/display.cpp b/src/game/display.cpp index cf851a8..988a6dd 100644 --- a/src/game/display.cpp +++ b/src/game/display.cpp @@ -20,8 +20,8 @@ void Game::displayAll(unsigned fps) const { for (unsigned i = 0; i < this->grid.size(); ++i){ for (unsigned j = 0; j < this->grid[i].size(); ++j){ Position vec( - basePos.getX() + i * confData.invadersSize + i * confData.invadersDistance, - basePos.getY() + j * confData.invadersSize + j * confData.invadersDistance + baseInvPos.getX() + i * confData.invadersSize + i * confData.invadersDistance, + baseInvPos.getY() + j * confData.invadersSize + j * confData.invadersDistance ); displayInvader(vec, grid[i][j]); } @@ -36,13 +36,17 @@ void Game::displayAll(unsigned fps) const { displayGod(); - displayScore(); DEBUG_INSTR( pm->drawText(Position(pm->getScreenWidth()-200, 20), "FPS : "+to_string(fps), nsGraphics::KWhite, Font::BITMAP_8_BY_13); ) + unsigned margin = 0; for(unsigned i=0;idrawText(Position(0,10+margin),"player "+to_string(i+1)+" :",nsGraphics::KWhite,Font::BITMAP_8_BY_13); + pm->drawText(Position(100,10+margin),to_string(players[i].score) ,nsGraphics::KWhite,Font::BITMAP_8_BY_13); + margin +=15; + if(!players[i].isEliminated()){ if(players[i].deathAnimCounter%2==0){ pm->drawPlayer(players[i].x, confData.playersWidth, confData.playerDefs[i].color); @@ -70,17 +74,6 @@ void Game::displayHearts(playerID pID) const { } } -void Game::displayScore() const{ - unsigned margin = 0; - unsigned playerNumber = 1; - for (auto& player: players){ - pm->drawText(Position(0,10+margin),"player "+to_string(playerNumber)+" :",nsGraphics::KWhite,Font::BITMAP_8_BY_13); - pm->drawText(Position(100,10+margin),to_string(player.score) ,nsGraphics::KWhite,Font::BITMAP_8_BY_13); - ++playerNumber; - margin +=15; - } -} - void Game::displayInvader(const Position& pos, InvaderType type) const { if(type==InvaderType::NONE)return; const InvaderTypeDef& invDef = confData.invadersDef.at(type); diff --git a/src/game/gameBasics.cpp b/src/game/gameBasics.cpp index 59ea6df..492cd0c 100644 --- a/src/game/gameBasics.cpp +++ b/src/game/gameBasics.cpp @@ -104,7 +104,7 @@ void Game::initGame(){ players[i].lives = confData.playersLives; } - basePos = Position(200, 0); + baseInvPos = Position(200, 0); direction = true; } @@ -169,7 +169,7 @@ WinValue Game::enterGameLoop(){ // returns when game is finished } Position Game::invIndexToPos(unsigned x, unsigned y) const { - return basePos+Position(INV_GET_SINGLE_POS(x), INV_GET_SINGLE_POS(y)); + return baseInvPos + Position(INV_GET_SINGLE_POS(x), INV_GET_SINGLE_POS(y)); } bool Game::arePlayersDead() { diff --git a/src/game/gameManagers.cpp b/src/game/gameManagers.cpp index cd60b8d..f5f2089 100644 --- a/src/game/gameManagers.cpp +++ b/src/game/gameManagers.cpp @@ -55,7 +55,7 @@ bool Game::manageInvaders(){ unsigned rdCol = grid.randomValidCol(); // fire ! - missiles.push_back(basePos + Position( + missiles.push_back(baseInvPos + Position( confData.invadersSize * rdCol + confData.invadersDistance * (rdCol + 0.5), confData.invadersSize * (grid[rdCol].size() - 1) + confData.invadersDistance * (grid[rdCol].size() - 1) )); @@ -63,7 +63,7 @@ bool Game::manageInvaders(){ if(direction){ // go to the right - int end = basePos.getX(); // start Position + int end = baseInvPos.getX(); // start Position end+= grid.size() * confData.invadersSize; // add the invaders end+= (grid.size()-1) * confData.invadersDistance; // add the invadersDistance between invaders // you got the end position of the invader crowd ! @@ -75,26 +75,26 @@ bool Game::manageInvaders(){ } if(end + confData.invadersSpeed < pm->getScreenWidth()){ - basePos.setX(basePos.getX() + confData.invadersSpeed); + baseInvPos.setX(baseInvPos.getX() + confData.invadersSpeed); } else{ - basePos.setY(basePos.getY() + confData.invadersSize + confData.invadersDistance); + baseInvPos.setY(baseInvPos.getY() + confData.invadersSize + confData.invadersDistance); direction = !direction; return true; } } else{ size_t i = 0; - unsigned relativeBasePos = basePos.getX(); + unsigned relativeBasePos = baseInvPos.getX(); while (grid[i].hasNoValid()){ relativeBasePos += confData.invadersSize + confData.invadersDistance; ++i; } if(relativeBasePos >= confData.invadersSpeed){ - basePos.setX(basePos.getX() - confData.invadersSpeed); + baseInvPos.setX(baseInvPos.getX() - confData.invadersSpeed); }else{ - basePos.setY(basePos.getY() + confData.invadersSize + confData.invadersDistance); + baseInvPos.setY(baseInvPos.getY() + confData.invadersSize + confData.invadersDistance); direction = !direction; return true; } @@ -186,7 +186,7 @@ bool Game::checkTorpedosAndInvaders() { unsigned alienIndex = grid[i].getOutterInvader(); if(alienIndex==grid[i].size())continue; // calculate top-left Position of invader - Position pos = basePos + Position( + Position pos = baseInvPos + Position( confData.invadersSize*i+confData.invadersDistance*i, confData.invadersSize*alienIndex+confData.invadersDistance*alienIndex ); @@ -218,8 +218,8 @@ bool Game::checkTorpedosAndInvaders() { bool Game::invadersTouchPlayer() const { return any_of(grid.begin(), grid.end(), [this](const InvadersColumn& line) -> bool { unsigned outter = line.getOutterInvader(); - return this->basePos.getY()+confData.invadersSize*(outter+1) - +confData.invadersDistance*outter + return this->baseInvPos.getY() + confData.invadersSize * (outter + 1) + +confData.invadersDistance*outter >= pm->getScreenHeight() - PLAYER_HEIGHT; }); } diff --git a/src/game/godManager.cpp b/src/game/godManager.cpp index bcdce3c..e5373a3 100644 --- a/src/game/godManager.cpp +++ b/src/game/godManager.cpp @@ -11,7 +11,7 @@ #include "game.h" void Game::tryAwakeGod() { - if (basePos.getY() > 100 /*lambda value*/ && god.state==GodState::NONE) { + if (baseInvPos.getY() > 100 /*lambda value*/ && god.state == GodState::NONE) { god.counter = 0; god.state = GodState::AWAKE; } @@ -50,7 +50,7 @@ bool Game::manageGod() { god.thrownInvType = InvaderType::NONE; god.thrownTransition.setX(pm->getScreenWidth() - GOD_HAND_DISTANCE - GOD_HAND_SIZE); - god.thrownTransition.setY(basePos.getY() + INV_GET_SINGLE_POS(god.thrownInvPosY)); + god.thrownTransition.setY(baseInvPos.getY() + INV_GET_SINGLE_POS(god.thrownInvPosY)); return false; } case GodState::RETRIEVE1: {