fix(MCU课设): 修复一个方块移动的bug
This commit is contained in:
parent
8c19878cc9
commit
8e4172d69d
2 changed files with 755 additions and 733 deletions
File diff suppressed because it is too large
Load diff
|
@ -163,10 +163,16 @@ void moveLeftPiece()
|
|||
for(i = 0; i < MAX_X; i++)
|
||||
for(j = 0; j < MAX_Y; j++)
|
||||
if(base[i][j] == 2 && !isIegal(i - 1, j))
|
||||
{
|
||||
return;
|
||||
}
|
||||
for(i = 0; i < MAX_X; i++)
|
||||
for(j = 0; j < MAX_Y; j++)
|
||||
if(base[i][j] == 2)
|
||||
{
|
||||
base[i - 1][j] = 2;
|
||||
base[i][j] = 0;
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
void moveRightPiece()
|
||||
|
@ -175,7 +181,13 @@ void moveRightPiece()
|
|||
char i, j;
|
||||
for(i = MAX_X - 1; i >= 0; i--)
|
||||
for(j = MAX_Y - 1; j >= 0; j--)
|
||||
if(base[i][j] == 2 && isIegal(i + 1, j))
|
||||
if(base[i][j] == 2 && !isIegal(i + 1, j))
|
||||
{
|
||||
return;
|
||||
}
|
||||
for(i = MAX_X - 1; i >= 0; i--)
|
||||
for(j = MAX_Y - 1; j >= 0; j--)
|
||||
if(base[i][j] == 2 )
|
||||
{
|
||||
base[i + 1][j] = 2;
|
||||
base[i][j] = 0;
|
||||
|
@ -200,12 +212,12 @@ void judgeBlock()
|
|||
}
|
||||
//计数足则整体下移
|
||||
if(count == 8)
|
||||
{
|
||||
score++;
|
||||
for(k = 0; k < MAX_X; k++)
|
||||
for(h = j ; h < MAX_Y-1; h++)
|
||||
base[k][h] = base[k][h + 1];
|
||||
}
|
||||
{
|
||||
score++;
|
||||
for(k = 0; k < MAX_X; k++)
|
||||
for(h = j ; h < MAX_Y - 1; h++)
|
||||
base[k][h] = base[k][h + 1];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in a new issue