diff --git a/Board.cpp b/Board.cpp index 9d5cc8e..f1e3bea 100644 --- a/Board.cpp +++ b/Board.cpp @@ -67,20 +67,22 @@ void Board::convertClump(int ind){ if (c.getBlockPosition(b).x==b2.pos.x) { b2.markedForDeletion=true; c2.addBlock(b2.pos,b2.col); + game->gameBoard.assignRandomColor(c2.getBlocks()[c2.getBlocks().size()-1]); } } c2.y=c.y; } - c2.landTime=game->gameBoard.landTime; clumpsToAdd.push_back(c2); } else { for (int i=0;igameBoard.landTime; b2.pos=c.getBlockPosition(b2); b2.pos.y=(int)(b2.pos.y+1)/12*12; b2.markedForDeletion=true; + if (b2.col==BlockColor::LAUNCHED) { + game->gameBoard.assignRandomColor(b2); + } cols[b.pos.x/12].push_back(b2); } } diff --git a/C++ProjectTemplate b/C++ProjectTemplate index b139410..b574d88 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/main.cpp b/main.cpp index 8bf33d2..3a4ec33 100644 --- a/main.cpp +++ b/main.cpp @@ -43,17 +43,6 @@ void Meteos::updateGame(float fElapsedTime){ BlockClump&c=gameBoard.getBlockClumps()[i]; if (c.launchTime>0) { c.launchTime-=fElapsedTime; - } else - if (c.landTime>0) { - c.landTime-=fElapsedTime; - if (c.landTime<=0) { - c.landTime=0; - for (int j=0;j=b2.pos.y&&c.getBlockPosition(b).y<=b2.pos.y+12){ - c.y-=c.getBlockPosition(b).y+12-b2.pos.y; + for (int j=0;j=b2.pos.y&&c.getBlockPosition(b).y<=b2.pos.y+12){ + c.y-=c.getBlockPosition(b).y+12-b2.pos.y; + c.vspeed=0; + if (c.landTime>=gameBoard.landTime) { + gameBoard.convertClump(i--); + } else { + c.landTime+=fElapsedTime; + } + goto nextClump; + } + } + if (c.getBlockPosition(b).y>=gameBoard.yBottom) { + c.y-=c.getBlockPosition(b).y-gameBoard.yBottom; c.vspeed=0; - gameBoard.convertClump(i--); + if (c.landTime>=gameBoard.landTime) { + gameBoard.convertClump(i--); + } else { + c.landTime+=fElapsedTime; + } goto nextClump; } } - if (c.getBlockPosition(b).y>=gameBoard.yBottom) { - c.y-=c.getBlockPosition(b).y-gameBoard.yBottom; - c.vspeed=0; - gameBoard.convertClump(i--); - goto nextClump; - } - } + c.landTime=0; nextClump:; } for (BlockClump&c:gameBoard.getBlockClumps()){ @@ -397,30 +395,12 @@ void Meteos::drawGame(float fElapsedTime){ BlockClump&c=gameBoard.getBlockClumps()[i]; for (int j=0;j0) { - b.resetTime-=fElapsedTime; - if (b.resetTime<0) { - b.resetTime=0; - if (b.col==BlockColor::LAUNCHED) { - gameBoard.assignRandomColor(b); - } - } - } DrawPartialDecal(c.getBlockPosition(b)+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); } } for (int i=0;i0) { - b.resetTime-=fElapsedTime; - if (b.resetTime<0) { - b.resetTime=0; - if (b.col==BlockColor::LAUNCHED) { - gameBoard.assignRandomColor(b); - } - } - } DrawPartialDecal(b.pos+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); } }