diff --git a/Board.cpp b/Board.cpp index ec4f3c1..a8ada80 100644 --- a/Board.cpp +++ b/Board.cpp @@ -73,9 +73,15 @@ void Board::convertClump(int ind){ } clumpsToAdd.push_back(c2); } else { - b.pos=c.getBlockPosition(b); - b.pos.y=(int)(b.pos.y+1)/12*12; - cols[b.pos.x/12].push_back(b); + for (int i=0;i #include "gameDefines.h" +#include Meteos*game; @@ -12,7 +13,7 @@ bool Meteos::OnUserCreate() SPRITES["blocks_test.png"].Load("assets/blocks_test.png"); std::random_device rd; //Will be used to obtain a seed for the random number engine - gen=std::mt19937(rd()); //Standard mersenne_twister_engine seeded with rd() + gen=std::mt19937(0); //Standard mersenne_twister_engine seeded with rd() randBlockPos=std::uniform_int_distribution<>(0, 9); coinFlip=std::uniform_int_distribution<>(0, 1); @@ -24,9 +25,9 @@ bool Meteos::OnUserCreate() bool Meteos::OnUserUpdate(float fElapsedTime) { accumulatedTime+=fElapsedTime; - while (accumulatedTime>=1/60.0f) { + if (accumulatedTime>=1/60.0f) { updateGame(1/60.0f); - accumulatedTime-=1/60.0f; + accumulatedTime=0; } drawGame(); return true; @@ -63,11 +64,16 @@ void Meteos::updateGame(float fElapsedTime){ yDiff-=snapYPos; c2.y+=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 for (int m=0;m0) { c.vspeed/=4; } @@ -75,6 +81,7 @@ void Meteos::updateGame(float fElapsedTime){ c2.vspeed/=4; } c.vspeed=c.vspeed*influence+c2.vspeed*(1-influence); + c.sortBlocks(); gameBoard.removeClump(j--); goto nextClumpCollisionCheck; }