下载此文档

091-越界检测.doc


文档分类:建筑/环境 | 页数:约2页 举报非法文档有奖
1/2
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/2 下载此文档
文档列表 文档介绍
091-越界检测
int CheckLeftBorder(chess_data Chess)
{
int x,y;
for(x=0;x<=3;x++)
for(y=0;y<=3;y++)
{
if (Ches091-越界检测
int CheckLeftBorder(chess_data Chess)
{
int x,y;
for(x=0;x<=3;x++)
for(y=0;y<=3;y++)
{
if ([x][y]) //判断棋子xy是不是为
{
if (+x<=CHESS_X+2)
{
return 1;
}
}
}
return 0;
}
/检测左边界是否到达,到达则返回否则为
//棋子坐标小于等棋盘左上角坐标
int CheckRightBorder(chess_data Chess)
{
int x,y;
for(x=0;x>=0;x--)
for(y=0;y>=0;y--)
{
if ([x][y]) //判断棋子xy是不是为
{
if (+x>=CHESS_X+CHESS_WIDTH-4)
{
return 1;
}
}
}
return 0;
}
//检测右边界
//左边界│占2字符宽度+右边界│占的2个字符宽度所以得减4
int CheckDownBorder(chess_data Chess)
{
int x,y;
for(y=0;y<=3;y++)
for(x=0;x<=3;x++)
{
if ([x][y]) //判断棋子xy是不是为
{
if (+y+1>=CHESS_Y+CHESS_HIGHT)
{
return 1;
}
}
}
return 0;
//检测下边界
//棋子坐标小于等棋盘左上角坐标
void playgame(void)
{
int ch=0;//读取键盘光标
chess_data oneChess;
InitChessData();//20种形状的函数
oneChess=DownChessData[0][0];
ShowChess(oneChess);
//开始游戏
091-越界检测
//光标控制游戏
while(1)
{
ch=getch(); //读取键盘光标存储到变量ch
gotoxy(35,30);
switch(ch)
{
default:
printf(

091-越界检测 来自淘豆网m.daumloan.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数2
  • 收藏数0 收藏
  • 顶次数0
  • 上传人260933426
  • 文件大小25 KB
  • 时间2022-05-21