- void applyBezierCurbe |
+ void applyBezierCurve |
( |
Position & |
pos, |
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 7722eaf..a539a26 100644
--- a/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp_source.html
+++ b/doc/SAE102-SpaceInvaders/html/db/d86/display_8cpp_source.html
@@ -169,7 +169,7 @@ $(document).ready(function(){initNavTree('db/d86/display_8cpp_source.html','../.
-
+
97 pos += (point-pos)*percent;
@@ -207,8 +207,8 @@ $(document).ready(function(){initNavTree('db/d86/display_8cpp_source.html','../.
-
-
+
+
138 pm->drawSprite(pm->rightHand, pos);
@@ -256,7 +256,7 @@ $(document).ready(function(){initNavTree('db/d86/display_8cpp_source.html','../.
InvaderType thrownInvType
type of the invader thrown by the hand of god
unsigned thrownInvPosX
x index (column in the grid) of the invader thrown by the hand of god
-void applyBezierCurbe(Position &pos, const Position &point, const double percent)
+void applyBezierCurve(Position &pos, const Position &point, const double percent)
full game logic and display management
#define GOD_HAND_DISTANCE
diff --git a/doc/SAE102-SpaceInvaders/html/globals.html b/doc/SAE102-SpaceInvaders/html/globals.html
index 1fe2a7c..b630856 100644
--- a/doc/SAE102-SpaceInvaders/html/globals.html
+++ b/doc/SAE102-SpaceInvaders/html/globals.html
@@ -93,7 +93,7 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); })
- a -
- ADD_SPRITE_TASK : pixelManager.h
-- applyBezierCurbe() : display.cpp
+- applyBezierCurve() : display.cpp
- applyTransformation() : utils.h, utils.cpp
- ARCHITECTURE_ID : CMakeCCompilerId.c, CMakeCXXCompilerId.cpp
- areLinesColliding() : utils.h, utils.cpp
diff --git a/doc/SAE102-SpaceInvaders/html/globals_func.html b/doc/SAE102-SpaceInvaders/html/globals_func.html
index 38b862b..959e6e0 100644
--- a/doc/SAE102-SpaceInvaders/html/globals_func.html
+++ b/doc/SAE102-SpaceInvaders/html/globals_func.html
@@ -85,7 +85,7 @@ $(document).ready(function(){initNavTree('globals_func.html',''); initResizable(
-- applyBezierCurbe() : display.cpp
+- applyBezierCurve() : display.cpp
- applyTransformation() : utils.h, utils.cpp
- areLinesColliding() : utils.h, utils.cpp
- main() : CMakeCCompilerId.c, CMakeCXXCompilerId.cpp, main.cpp
diff --git a/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp.tex b/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp.tex
index a6c4182..906e803 100644
--- a/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp.tex
+++ b/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp.tex
@@ -45,7 +45,7 @@ Definition in file \mbox{\hyperlink{display_8cpp_source}{display.\+cpp}}.
\mbox{\Hypertarget{display_8cpp_a72e79615fef9e4505aad10d5b4fb4b5e}\label{display_8cpp_a72e79615fef9e4505aad10d5b4fb4b5e}}
\index{display.cpp@{display.cpp}!applyBezierCurbe@{applyBezierCurbe}}
\index{applyBezierCurbe@{applyBezierCurbe}!display.cpp@{display.cpp}}
-\doxysubsubsection{\texorpdfstring{applyBezierCurbe()}{applyBezierCurbe()}}
+\doxysubsubsection{\texorpdfstring{applyBezierCurbe()}{applyBezierCurve()}}
{\footnotesize\ttfamily void apply\+Bezier\+Curbe (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} \&}]{pos, }\item[{const \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} \&}]{point, }\item[{const double}]{percent }\end{DoxyParamCaption})}
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 290b992..fb600de 100644
--- a/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp_source.tex
+++ b/doc/SAE102-SpaceInvaders/latex/db/d86/display_8cpp_source.tex
@@ -123,7 +123,7 @@
\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00132}00132 \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}} endPos = invIndexToPos(god.\mbox{\hyperlink{class_god_ae7ed525f130083f511728c791c35a95d}{thrownInvPosX}}, god.\mbox{\hyperlink{class_god_a26fbb775dff480eaa6a19d4a3ef9731c}{thrownInvPosY}});}
\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00133}00133 }
\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00134}00134 \mbox{\hyperlink{display_8cpp_a72e79615fef9e4505aad10d5b4fb4b5e}{applyBezierCurbe}}(pos, god.\mbox{\hyperlink{class_god_a41b9ceec78e403a54cf8afaf6e50519a}{thrownTransition}}, god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} / 100.0);}
-\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00135}00135 \mbox{\hyperlink{display_8cpp_a72e79615fef9e4505aad10d5b4fb4b5e}{applyBezierCurbe}}(pos, endPos, god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} / 100.0);}
+\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00135}00135 \mbox{\hyperlink{display_8cpp_a72e79615fef9e4505aad10d5b4fb4b5e}{applyBezierCurve}}(pos, endPos, god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} / 100.0);}
\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00136}00136 }
\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00137}00137 \textcolor{comment}{// pos is now the position we need to draw our hand to}}
\DoxyCodeLine{\Hypertarget{display_8cpp_source_l00138}00138 pm-\/>drawSprite(pm-\/>rightHand, pos);}
diff --git a/src/display.cpp b/src/display.cpp
index 19ee8a8..ee1dace 100644
--- a/src/display.cpp
+++ b/src/display.cpp
@@ -94,7 +94,7 @@ void Game::displayInvader(const Position& pos, InvaderType type) const {
}
}
-void applyBezierCurbe(Position& pos, const Position& point, const double percent) {
+void applyBezierCurve(Position& pos, const Position& point, const double percent) {
pos += (point-pos)*percent;
}
@@ -132,8 +132,8 @@ void Game::displayGod() const {
Position pos(god.getRightHandPos(pm->getScreenWidth()));
Position endPos = invIndexToPos(god.thrownInvPosX, god.thrownInvPosY);
- applyBezierCurbe(pos, god.thrownTransition, god.counter / 100.0);
- applyBezierCurbe(pos, endPos, god.counter / 100.0);
+ applyBezierCurve(pos, god.thrownTransition, god.counter / 100.0);
+ applyBezierCurve(pos, endPos, god.counter / 100.0);
// pos is now the position we need to draw our hand to
pm->drawSprite(pm->rightHand, pos);
diff --git a/src/godManager.cpp b/src/godManager.cpp
index 8ac929a..dad71e0 100644
--- a/src/godManager.cpp
+++ b/src/godManager.cpp
@@ -47,6 +47,7 @@ bool Game::manageGod() {
// init throw
god.counter = 0;
god.state = GodState::RETRIEVE1;
+ // We're sure there is at least one valid column/invader, else the game would have ended and we would not be here
god.thrownInvPosX = grid.randomValidCol();
god.thrownInvPosY = grid[god.thrownInvPosX].randomValidInv();
god.thrownInvType = InvaderType::NONE;
@@ -116,10 +117,6 @@ bool Game::manageGod() {
(invaderPos.getX() < 0 || invaderPos.getX() + confData.invadersSize >= pm->getScreenWidth())) {
touched = true;
- /* there are no invaders in the grid anymore, and the one thrown just went out of bound
- * So... return true, the player wins*/
- if(!areThereInvadersLeft())return true;
-
// check player collision
} else if (invaderPos.getY() + confData.invadersSize >= pm->getScreenHeight() - PLAYER_HEIGHT) {
for (Player &p: players) {
@@ -138,6 +135,9 @@ bool Game::manageGod() {
if (touched) {
god.state = GodState::WAIT;
god.counter = 0;
+ /* there are no invaders in the grid anymore, and the one thrown just disappeared
+ * So... return true, the player wins*/
+ if(!areThereInvadersLeft())return true;
}
/* we do not need to reset other members, they'll be treated as non-initialized
* When we cycle back between states*/