I'm depressed help

This commit is contained in:
Thomas 2022-01-10 09:23:08 +01:00
parent a10a1e67c5
commit 7a816b5f71
No known key found for this signature in database
GPG Key ID: E538821A6CDFDAD7
4 changed files with 10 additions and 12 deletions

View File

@ -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"

View File

@ -80,7 +80,7 @@ struct ConfigData {
* @brief distance in pixel between two invader
*/
unsigned invadersDistance;
/*!
* @brief wait time between two invader missile
*/

View File

@ -221,8 +221,6 @@ private:
*/
bool invadersTouchPlayer() const;
// god things
/*!
* @brief change god's state to awake
* @fn void awakeGod();

View File

@ -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;
});
}