|
|
@ -12,13 +12,12 @@ bool Meteos::OnUserCreate() |
|
|
|
SPRITES["blocks_test.png"].Load("assets/blocks_test.png"); |
|
|
|
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
|
|
|
|
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(rd()); //Standard mersenne_twister_engine seeded with rd()
|
|
|
|
gen=std::mt19937(0); |
|
|
|
|
|
|
|
//Seed 0 causes a stacked block in the middle row followed by a giant stack up soon after.
|
|
|
|
//Seed 0 causes a stacked block in the middle row followed by a giant stack up soon after.
|
|
|
|
randBlockPos=std::uniform_int_distribution<>(0, 9); |
|
|
|
randBlockPos=std::uniform_int_distribution<>(0, 9); |
|
|
|
coinFlip=std::uniform_int_distribution<>(0, 1); |
|
|
|
coinFlip=std::uniform_int_distribution<>(0, 1); |
|
|
|
|
|
|
|
|
|
|
|
gameBoard=Board({10,14},0.2f,1.f,-6.f,1.0f,{3,0,0,0,0,0,0,0,0,0},SPRITES["blocks_test.png"]); |
|
|
|
gameBoard=Board({10,14},0.04f,0.7f,-1.f,1.7f,1.0f,{3,0,0,0,0,0,0,0,0,0},SPRITES["blocks_test.png"]); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -42,7 +41,11 @@ void Meteos::updateGame(float fElapsedTime){ |
|
|
|
} |
|
|
|
} |
|
|
|
for (int i=0;i<gameBoard.getBlockClumps().size();i++){ |
|
|
|
for (int i=0;i<gameBoard.getBlockClumps().size();i++){ |
|
|
|
BlockClump&c=gameBoard.getBlockClumps()[i]; |
|
|
|
BlockClump&c=gameBoard.getBlockClumps()[i]; |
|
|
|
c.vspeed+=gameBoard.gravity; |
|
|
|
if (c.launchTime>0) { |
|
|
|
|
|
|
|
c.launchTime-=fElapsedTime; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
c.vspeed+=gameBoard.gravity; |
|
|
|
|
|
|
|
} |
|
|
|
if (c.vspeed>gameBoard.maxGravity){ |
|
|
|
if (c.vspeed>gameBoard.maxGravity){ |
|
|
|
c.vspeed=gameBoard.maxGravity; |
|
|
|
c.vspeed=gameBoard.maxGravity; |
|
|
|
} |
|
|
|
} |
|
|
@ -205,6 +208,7 @@ void Meteos::updateGame(float fElapsedTime){ |
|
|
|
Block&b=c.getBlocks()[i]; |
|
|
|
Block&b=c.getBlocks()[i]; |
|
|
|
b.col=BlockColor::LAUNCHED; |
|
|
|
b.col=BlockColor::LAUNCHED; |
|
|
|
c.vspeed=gameBoard.launchSpd; |
|
|
|
c.vspeed=gameBoard.launchSpd; |
|
|
|
|
|
|
|
c.launchTime=gameBoard.launchTime; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
std::vector<std::pair<int,int>>matchedBlockIDs; //Col followed by index
|
|
|
|
std::vector<std::pair<int,int>>matchedBlockIDs; //Col followed by index
|
|
|
@ -322,6 +326,7 @@ void Meteos::updateGame(float fElapsedTime){ |
|
|
|
} |
|
|
|
} |
|
|
|
b.col=BlockColor::LAUNCHED; |
|
|
|
b.col=BlockColor::LAUNCHED; |
|
|
|
c.vspeed=gameBoard.launchSpd; |
|
|
|
c.vspeed=gameBoard.launchSpd; |
|
|
|
|
|
|
|
c.launchTime=gameBoard.launchTime; |
|
|
|
} |
|
|
|
} |
|
|
|
for (std::pair<int,int>&info:matchedBlockIDs) { |
|
|
|
for (std::pair<int,int>&info:matchedBlockIDs) { |
|
|
|
Block&b=gameBoard.getBlocks(info.first)[info.second]; |
|
|
|
Block&b=gameBoard.getBlocks(info.first)[info.second]; |
|
|
|