Horizontal matches

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

Binary file not shown.

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

Loading…
Cancel
Save