# curriculum design 12 **Repository Path**: group_12_course_design/curriculum-design-12 ## Basic Information - **Project Name**: curriculum design 12 - **Description**: No description available - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-06-19 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #include #include #include #include #include #include #include #pragma comment (lib,"Winmm.lib") #define WIDTH 200//游戏区宽度 #define HEIGHT 400//高度 #define UNIT 20//每个游戏区单位的实际像素 //全局变量 int g_arrBackGround[20][10]={0};//背景分割 int g_arrSqare[2][4]={0}; int n; int t;//输入密码次数 COLORREF c;//方块颜色 //函数声明 void startup();//初始化 void show();//显示函数,清全屏 void CreateRandonSqare();//随机显示图形 void CopySqareToBack();//把图形写入背景数组 void SqareDown();//下降 void SqareLeft();//左移 void SqareRight();//右移 void SqareDown2();//下降 int CanSqareDown();//若返回0继续下降,返回1则代表到底,不下降 int CanSqareDown2();//若返回0继续下降,返回1则代表到底,不下降,与方块相遇 int CanSqareLeft();//若返回0继续左移,返回1则代表到最左边,不再左移 int CanSqareLeft2();//若返回0继续左移,返回1则代表到最左边,不再左移,与方块相遇 int CanSqareRight();//若返回0继续右移,返回1则代表到最右边,不再右移 int CanSqareRight2();//若返回0继续右移,返回1则代表到最右边,不再右移,与方块相遇 void PaintSqare();//画方块 void Change1TO2();//到底之后数组由1变2 void gotoxy(int x,int y);//清屏 void UpWithoutInput();//与用户无关的输入 void ShowSqare2();//2的时候也画方块到背景 void UpWithInput();//与用户有关的输入 void UpWithInput() { char input; while(kbhit())//判断是否有输入 { input = getch();//根据用户的不同输入来移动 if(input==75)//左移 { if(CanSqareLeft()==1&&CanSqareLeft2()==1) { SqareLeft(); } } if (input==77)//右移 { if(CanSqareRight()==1&&CanSqareRight2()==1) { SqareRight(); } } if(input==80)//下移 { SqareDown2(); } } }