diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 17ad190..8762146 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/assets/blocks_test.png b/assets/blocks_test.png index ad76d15..794060c 100644 Binary files a/assets/blocks_test.png and b/assets/blocks_test.png differ diff --git a/main.cpp b/main.cpp index 95a343d..b9f21e1 100644 --- a/main.cpp +++ b/main.cpp @@ -17,7 +17,7 @@ bool Meteos::OnUserCreate() randBlockPos=std::uniform_int_distribution<>(0, 9); coinFlip=std::uniform_int_distribution<>(0, 1); - gameBoard=Board({10,14},0.04f,1.2f,-1.f,1.7f,2.0f,1.0f,{3,0,0,0,0,0,0,0,0,0},SPRITES["blocks_test.png"]); + gameBoard=Board({10,14},0.04f,1.2f,-1.f,1.7f,2.0f,1.0f,{3,3,0,0,0,0,0,0,0,0},SPRITES["blocks_test.png"]); return true; } @@ -49,7 +49,9 @@ void Meteos::updateGame(float fElapsedTime){ if (c.landTime<=0) { c.landTime=0; for (int j=0;j=c.getBlockPosition(b3).y&& c2.getBlockPosition(b2).y<=c.getBlockPosition(b3).y+12) { - float yDiff=c2.getBlockPosition(b2).y; - float snapYPos=c.getBlockPosition(b3).y; - yDiff-=snapYPos; - c2.y+=yDiff; + float yDiff=(c2.getBlockPosition(b2).y>c.getBlockPosition(b3).y)? + c2.getBlockPosition(b2).y-c.getBlockPosition(b3).y: + c.getBlockPosition(b3).y-c2.getBlockPosition(b2).y; + c2.y+=(c2.getBlockPosition(b2).y>c.getBlockPosition(b3).y)? + yDiff:-yDiff; float influence=(float)c.getBlocks().size()/(c.getBlocks().size()+c2.getBlocks().size()); int blockCount=c.getBlocks().size(); //Copy every block from one clump to the other @@ -385,7 +388,9 @@ void Meteos::drawGame(float fElapsedTime){ b.resetTime-=fElapsedTime; if (b.resetTime<0) { b.resetTime=0; - gameBoard.assignRandomColor(b); + if (b.col==BlockColor::LAUNCHED) { + gameBoard.assignRandomColor(b); + } } } DrawPartialDecal(c.getBlockPosition(b)+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12}); @@ -398,7 +403,9 @@ void Meteos::drawGame(float fElapsedTime){ b.resetTime-=fElapsedTime; if (b.resetTime<0) { b.resetTime=0; - gameBoard.assignRandomColor(b); + if (b.col==BlockColor::LAUNCHED) { + gameBoard.assignRandomColor(b); + } } } DrawPartialDecal(b.pos+gameBoard.drawOffset,gameBoard.tileset,{(float)(int)b.col*12,0},{12,12});