Horizontal matches

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent fe94a9d39c
commit c4df26a5a3
  1. BIN
      C++ProjectTemplate
  2. 30
      main.cpp

Binary file not shown.

@ -194,30 +194,32 @@ bool Meteos::OnUserUpdate(float fElapsedTime)
matchedBlocksX.push_back(&b); matchedBlocksX.push_back(&b);
matchedBlocksY.push_back(&b); matchedBlocksY.push_back(&b);
rightCheckGrounded: rightCheckGrounded:
float checkX=targetX+12; float checkX=1;
float checkY=targetY; float checkY=targetY;
do{ do{
found=false; found=false;
for (Block&b2:gameBoard.getBlocks(i)){ if (i+checkX<gameBoard.boardSize.x) {
if (b.pos.x==b2.pos.x&&b.pos.y==b2.pos.y)continue; for (Block&b2:gameBoard.getBlocks(i+checkX)){
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==b.pos.x+checkX*12&&b2.pos.y==checkY) {
found=true; found=true;
checkX+=12; checkX++;
matchedBlocksX.push_back(&b2); matchedBlocksX.push_back(&b2);
}
} }
} }
}while(found); }while(found);
leftCheckGrounded: leftCheckGrounded:
checkX=targetX-12; checkX=-1;
checkY=targetY; checkY=targetY;
do{ do{
found=false; found=false;
for (Block&b2:gameBoard.getBlocks(i)){ if (i+checkX>=0) {
if (b.pos.x==b2.pos.x&&b.pos.y==b2.pos.y)continue; for (Block&b2:gameBoard.getBlocks(i+checkX)){
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==b.pos.x+checkX*12&&b2.pos.y==checkY) {
found=true; found=true;
checkX-=12; checkX--;
matchedBlocksX.push_back(&b2); matchedBlocksX.push_back(&b2);
}
} }
} }
}while(found); }while(found);

Loading…
Cancel
Save