block_display(block_type, befor_dir_type, befor_back_x, befor_back_y, BACK);//原来的方块位置清除掉
if(-1 != block_dir)//左右移动了方块
{
if(ERROR == block_move_check_y(block_type, new_dir_type, new_back_x, new_back_y, block_dir))//检查移动的方块是触
碰到左右的方块
{
new_back_y = befor_back_y;
}
}
block_display(block_type, new_dir_type, new_back_x, new_back_y, NODE);//画下一个方块位置
if(ERROR == block_move_check_x(block_type, new_dir_type, new_back_x, new_back_y))//检查移动的方块是否触发到下面
的方块
{
break;
}
Sleep(time);
}
block_display(block_type, 0, 17, 26, BACK);//清楚预测区域的方块
if(OK == block_clear_sort())//检查下面方块是否等够得分,能得分则消除得分
{
set_windows_pos(8, 22);//更新得分
printf("%d", score);
}
}
return 0;
}
/***************************************************************/
/*** 画面背景的初始化 ***/
/***其中原点在右上角,竖轴为x轴,横轴为y轴。y(0 - 19)为方块区***/
/***域,20 - 30 为计分区域及方块预测提示区域 ***/
/***************************************************************/
void backgroud_init(void)
{
int x = 0, y = 0;
for(x = 0; x < 20; x++)
{
for(y = 0; y < 20; y++)
{
back[x][y] = BACK;
}
}
for(x = 0; x < 20; x++)
{
for(y = 20; y < 30; y++)
{
if((0 == x) || (4 == x) || (10 == x) || (19 == x))
{
back[x][y] = FRAME;
}
if((20 == y) || (29 == y))
{
back[x][y] = FRAME;
}
}
}
//背景图案的显示
for(x = 0; x < 20; x++)
{