diff --git a/C++ProjectTemplate b/C++ProjectTemplate index e13bde8..5e86890 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/main.cpp b/main.cpp index eb66913..91183c6 100644 --- a/main.cpp +++ b/main.cpp @@ -220,112 +220,129 @@ bool Meteos::OnUserUpdate(float fElapsedTime) } } for (int i=0;i>matchedBlockIDs; //Col followed by index for (Block&b:gameBoard.getBlocks(i)) { + b.addedToLaunchList=false; + } + for (int j=0;j>tempMatchIDsX; //Col followed by index + std::vector>tempMatchIDsY; //Col followed by index float targetX=b.pos.x; float targetY=b.pos.y; bool found=false; - std::vectormatchedBlocksX; - std::vectormatchedBlocksY; - matchedBlocksX.push_back(&b); - matchedBlocksY.push_back(&b); - rightCheckGrounded: + tempMatchIDsX.push_back({i,j}); + tempMatchIDsY.push_back({i,j}); + rightBoardCheck: float checkX=1; float checkY=targetY; do{ found=false; 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) { + for (int k=0;k2||matchedBlocksY.size()>2) { - BlockClump c; - c.y=b.pos.y-1; - if (matchedBlocksX.size()>2) { - for (Block*b2:matchedBlocksX) { - b2->col=BlockColor::LAUNCHED; - c.addBlockOnTopOf(b2->pos.x/12,b2->col); - b2->markedForRemoval=true; - } - for (Block*b2:matchedBlocksX) { - for (Block&b3:gameBoard.getBlocks(b2->pos.x/12)) { - if (!b3.markedForRemoval&&b3.pos.ypos.y) { - c.addBlockOnTopOf(b2->pos.x/12,b3.col); - b3.markedForRemoval=true; - } + if (tempMatchIDsX.size()>2||tempMatchIDsY.size()>2) { + if (tempMatchIDsX.size()>2) { + for (std::pair&info:tempMatchIDsX) { + Block&bb=gameBoard.getBlocks(info.first)[info.second]; + if (!bb.addedToLaunchList) { + bb.addedToLaunchList=true; + matchedBlockIDs.push_back(info); } } - c.vspeed=gameBoard.launchSpd; } - if (matchedBlocksY.size()>2) { - for (int i=0;icol=BlockColor::LAUNCHED; - c.addBlockOnTopOf(b2->pos.x/12,b2->col); - b2->markedForRemoval=true; - } - for (int i=0;ipos.x/12)) { - if (!b3.markedForRemoval&&b3.pos.ypos.y) { - c.addBlockOnTopOf(b2->pos.x/12,b3.col); - b3.markedForRemoval=true; - } + if (tempMatchIDsY.size()>2) { + for (std::pair&info:tempMatchIDsY) { + Block&bb=gameBoard.getBlocks(info.first)[info.second]; + if (!bb.addedToLaunchList) { + bb.addedToLaunchList=true; + matchedBlockIDs.push_back(info); } } - c.vspeed=gameBoard.launchSpd; } - gameBoard.addClump(c); } } + if (matchedBlockIDs.size()>0) { + BlockClump c; + bool firstBlock=true; + for (std::pair&info:matchedBlockIDs) { + Block&b=gameBoard.getBlocks(info.first)[info.second]; + if (firstBlock) { + c.y=b.pos.y-1; + firstBlock=false; + } + std::cout<<"Launch Block ("<