Fix the clump y alignment...?

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent f64f41318a
commit 16b1290fe0
  1. 9
      Board.cpp
  2. BIN
      C++ProjectTemplate
  3. 27
      main.cpp

@ -17,15 +17,6 @@ maxWarningLevel(maxWarningLevel){
warningFlashingLevel.push_back(0.f); warningFlashingLevel.push_back(0.f);
} }
clumps.reserve(100); clumps.reserve(100);
BlockClump test1;
test1.addBlock(4,BlockColor::WHITE);
test1.addBlock(5,BlockColor::WHITE);
BlockClump test2;
test2.y=0;
test2.addBlock(6,BlockColor::WHITE);
test2.addBlock(7,BlockColor::WHITE);
addClump(test1);
addClump(test2);
} }
void Board::spawnBlock(int col){ void Board::spawnBlock(int col){

Binary file not shown.

@ -121,7 +121,7 @@ void Meteos::updateGame(float fElapsedTime){
lastBlockSpawn+=fElapsedTime; lastBlockSpawn+=fElapsedTime;
if (lastBlockSpawn>=gameBoard.spawnRate){ if (lastBlockSpawn>=gameBoard.spawnRate){
lastBlockSpawn-=gameBoard.spawnRate; lastBlockSpawn-=gameBoard.spawnRate;
//gameBoard.spawnBlock(randBlockPos(gen)); gameBoard.spawnBlock(randBlockPos(gen));
} }
for (int i=gameBoard.getBlockClumps().size()-1;i>=0;i--){ for (int i=gameBoard.getBlockClumps().size()-1;i>=0;i--){
BlockClump&c=gameBoard.getBlockClumps()[i]; BlockClump&c=gameBoard.getBlockClumps()[i];
@ -288,7 +288,7 @@ void Meteos::updateGame(float fElapsedTime){
found=true; found=true;
checkX+=12; checkX+=12;
tempMatchIDsX.push_back({(int)b.pos.x/12,j,g}); tempMatchIDsX.push_back({(int)b.pos.x/12,j,g});
break; goto outerRightCheck;
} }
} }
if (c.landTime>0){ if (c.landTime>0){
@ -298,7 +298,7 @@ void Meteos::updateGame(float fElapsedTime){
if (c2.landTime>0){ if (c2.landTime>0){
for (int j=0;j<c2.getBlocks().size();j++){ for (int j=0;j<c2.getBlocks().size();j++){
Block&b2=c2.getBlocks()[j]; Block&b2=c2.getBlocks()[j];
if (b.col==b2.col&&b2.col!=BlockColor::LAUNCHED&&b2.pos.x==checkX&&b2.pos.y==checkY) { if (b.col==b2.col&&b2.col!=BlockColor::LAUNCHED&&b2.pos.x==checkX&&b2.pos.y-c.y==checkY) {
found=true; found=true;
checkX+=12; checkX+=12;
tempMatchIDsX.push_back({(int)b2.pos.x/12,j,h}); tempMatchIDsX.push_back({(int)b2.pos.x/12,j,h});
@ -322,7 +322,7 @@ void Meteos::updateGame(float fElapsedTime){
found=true; found=true;
checkX-=12; checkX-=12;
tempMatchIDsX.push_back({(int)b.pos.x/12,j,g}); tempMatchIDsX.push_back({(int)b.pos.x/12,j,g});
break; goto outerLeftCheck;
} }
} }
if (c.landTime>0){ if (c.landTime>0){
@ -332,16 +332,17 @@ void Meteos::updateGame(float fElapsedTime){
if (c2.landTime>0){ if (c2.landTime>0){
for (int j=0;j<c2.getBlocks().size();j++){ for (int j=0;j<c2.getBlocks().size();j++){
Block&b2=c2.getBlocks()[j]; Block&b2=c2.getBlocks()[j];
if (b.col==b2.col&&b2.col!=BlockColor::LAUNCHED&&b2.pos.x==checkX&&b2.pos.y==checkY) { if (b.col==b2.col&&b2.col!=BlockColor::LAUNCHED&&b2.pos.x==checkX&&b2.pos.y-c.y==checkY) {
found=true; found=true;
checkX-=12; checkX-=12;
tempMatchIDsX.push_back({(int)b2.pos.x/12,j,h}); tempMatchIDsX.push_back({(int)b2.pos.x/12,j,h});
goto outerRightCheck; goto outerLeftCheck;
} }
} }
} }
} }
} }
outerLeftCheck:;
}while(found); }while(found);
upCheck: upCheck:
checkX=targetX; checkX=targetX;
@ -355,7 +356,7 @@ void Meteos::updateGame(float fElapsedTime){
found=true; found=true;
checkY-=12; checkY-=12;
tempMatchIDsY.push_back({(int)b.pos.x/12,j,g}); tempMatchIDsY.push_back({(int)b.pos.x/12,j,g});
break; goto outerUpCheck;
} }
} }
if (c.landTime>0){ if (c.landTime>0){
@ -365,16 +366,17 @@ void Meteos::updateGame(float fElapsedTime){
if (c2.landTime>0){ if (c2.landTime>0){
for (int j=0;j<c2.getBlocks().size();j++){ for (int j=0;j<c2.getBlocks().size();j++){
Block&b2=c2.getBlocks()[j]; Block&b2=c2.getBlocks()[j];
if (b.col==b2.col&&b2.col!=BlockColor::LAUNCHED&&b2.pos.x==checkX&&b2.pos.y==checkY) { if (b.col==b2.col&&b2.col!=BlockColor::LAUNCHED&&b2.pos.x==checkX&&b2.pos.y-c.y==checkY) {
found=true; found=true;
checkY-=12; checkY-=12;
tempMatchIDsY.push_back({(int)b2.pos.x/12,j,h}); tempMatchIDsY.push_back({(int)b2.pos.x/12,j,h});
goto outerRightCheck; goto outerUpCheck;
} }
} }
} }
} }
} }
outerUpCheck:;
}while(found); }while(found);
downCheck: downCheck:
checkX=targetX; checkX=targetX;
@ -388,7 +390,7 @@ void Meteos::updateGame(float fElapsedTime){
found=true; found=true;
checkY+=12; checkY+=12;
tempMatchIDsY.push_back({(int)b.pos.x/12,j,g}); tempMatchIDsY.push_back({(int)b.pos.x/12,j,g});
break; goto outerDownCheck;
} }
} }
if (c.landTime>0){ if (c.landTime>0){
@ -398,16 +400,17 @@ void Meteos::updateGame(float fElapsedTime){
if (c2.landTime>0){ if (c2.landTime>0){
for (int j=0;j<c2.getBlocks().size();j++){ for (int j=0;j<c2.getBlocks().size();j++){
Block&b2=c2.getBlocks()[j]; Block&b2=c2.getBlocks()[j];
if (b.col==b2.col&&b2.col!=BlockColor::LAUNCHED&&b2.pos.x==checkX&&b2.pos.y==checkY) { if (b.col==b2.col&&b2.col!=BlockColor::LAUNCHED&&b2.pos.x==checkX&&b2.pos.y-c.y==checkY) {
found=true; found=true;
checkY+=12; checkY+=12;
tempMatchIDsY.push_back({(int)b2.pos.x/12,j,h}); tempMatchIDsY.push_back({(int)b2.pos.x/12,j,h});
goto outerRightCheck; goto outerDownCheck;
} }
} }
} }
} }
} }
outerDownCheck:;
}while(found); }while(found);
if (tempMatchIDsX.size()>2||tempMatchIDsY.size()>2) { if (tempMatchIDsX.size()>2||tempMatchIDsY.size()>2) {
if (tempMatchIDsX.size()>2) { if (tempMatchIDsX.size()>2) {

Loading…
Cancel
Save