diff --git a/config.yml b/config.yml index 294ebd7..462c973 100644 --- a/config.yml +++ b/config.yml @@ -26,8 +26,8 @@ players: invaders: fireCooldown: 20 size: 40 - speed: 7 - distance: 10 # distance in pixels between invaders + speed: 5 + distance: 40 # distance in pixels between invaders typeA: points: 100 @@ -56,4 +56,4 @@ projectiles: grid: - "AAAAAAAAAA" - "BBBBBBBBBB" - - "CCCCCCCCCC" + - "CCCCCCCCCC" \ No newline at end of file diff --git a/headers/configData.h b/headers/configData.h index 39a675d..a5e8cc3 100644 --- a/headers/configData.h +++ b/headers/configData.h @@ -80,7 +80,7 @@ struct ConfigData { * @brief distance in pixel between two invader */ unsigned invadersDistance; - + /*! * @brief wait time between two invader missile */ diff --git a/headers/game.h b/headers/game.h index e47d424..661545e 100644 --- a/headers/game.h +++ b/headers/game.h @@ -221,8 +221,6 @@ private: */ bool invadersTouchPlayer() const; - // god things - /*! * @brief change god's state to awake * @fn void awakeGod(); diff --git a/src/game/gameManagers.cpp b/src/game/gameManagers.cpp index 8477e86..0b6d346 100644 --- a/src/game/gameManagers.cpp +++ b/src/game/gameManagers.cpp @@ -203,10 +203,10 @@ bool Game::checkTorpedosAndInvaders() { } bool Game::invadersTouchPlayer() const { - for(const InvadersColumn& line : grid){ - if(basePos.getY() + line.size() * confData.invadersSize >= pm.getScreenHeight() - PLAYER_HEIGHT){ - return true; - } - } - return false; + 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 + >= pm.getScreenHeight() - PLAYER_HEIGHT; + }); }