我介面介紹的影片:
void start_face()
{
int i , j;
for(i = 0 ; i < board_x ; i++)
{
for(j = 0 ; j < board_y + 10 ; j++)
{
if(j == 0 || j == board_y - 1 || j == board_y + 9)
{
Fc.data[i][j] = wall; //wall == 2
gotoxy(i , 2*j);
printf("□");
}
else if(i == board_x -1)
{
Fc.data[i][j] = floor; //floor == 1
gotoxy(i , 2*j);
printf("□");
}
else
{
Fc.data[i][j] = none;
}
}
}
gotoxy(board_x-18,2*board_y+2);
printf("left:←");
gotoxy(board_x-16,2*board_y+2);
printf("right:→");
gotoxy(board_x-14,2*board_y+2);
printf("rotate:space");
gotoxy(board_x-12,2*board_y+2);
printf("stop: S");
gotoxy(board_x-10,2*board_y+2);
printf("esc: ESC");
gotoxy(board_x-8,2*board_y+2);
printf("restart:R");
gotoxy(board_x-6,2*board_y+2);
printf("MAx score:%d",max);
gotoxy(board_x- 4,2*board_y+2);
printf("score:%d",grade);
我在介面設置時是先將介面邊緣設置為2(wall),上下為1(floor),而為甚麼橫向陣列要乘以2,是因為那個特殊方塊站2格的寬度,所以要gotoxy時或print基本上都給兩格的位置。
void start_dia() // intitialization the square
{
int i , j , k ,l ;
int cur[4][4];
for(i = 0 ; i < 3 ; i++){ // 土
square[0][0].space[1][i] = 1 ;
}
square[0][0].space[0][1] = 1;
//
for(i = 1 ; i < 4 ; i++)
{
square[1][0].space[i][1] = 1;
}
square[1][0].space[1][2] = 1;
//
for(i = 1 ; i < 4 ; i++)
{
square[2][0].space[i][1] = 1;
}
square[2][0].space[1][0] =1 ;
//
for(i = 0 ; i < 2 ; i++){
square[3][0].space[1][i] = 1; //z
square[3][0].space[2][i+1] = 1;
square[4][0].space[1][i+1]=1; //z2
square[4][0].space[2][i]=1;
square[5][0].space[1][i] =1 ;//田
square[5][0].space[2][i] = 1;
}
for(i = 0 ; i < 4 ; i++)
{
square[6][0].space[i][2] = 1;
}
/////////rotate
for( i = 0 ; i < 7 ; i++) //右轉90度 公式上學期有教過!!!! 拿來用
{
for( l = 0 ; l < 3 ; l++)
{
for( j = 0; j < 4; j++)
{
for( k = 0; k < 4 ; k++)
{
cur[j][k] = square[i][l].space[j][k];
}
}
for(j = 0 ; j < 4 ; j++)
{
for(k = 0; k < 4 ; k++)
{
square[i][l+1].space[j][k] = cur[3-k][j];
}
}
}
}
}
首先我先說明square的宣告,Square 是我宣告的結構,裡面方的是44二維陣列,然後我再宣告告一個74的結構陣列,7表 7種圖形 , 4 表 4種旋轉 ,然後把它設成1存在陣列!
匯入音樂的部分我是參考 網址:
How to add the music in Dev C /C ++
裡面有關於匯入音樂的教學 , 而我使用的音樂是:
遊戲內容介紹影片