坦克大战c语言程序贴吧,坦克大战!
該樓層疑似違規已被系統折疊?隱藏此樓查看此樓
amy[i].fire.x=amy[i].x;
amy[i].fire.y=amy[i].y;
}
break;
}
}
if(lose)/*因為失敗而跳出循環顯示失敗*/
{GameOver();break;}
if(GetKey(KEY_ESC))
break;
if(GetKey(KEY_UP))/*往上*/
{
if(Playone.direction==1&&map[Playone.x-1][Playone.y]!=1&&map[Playone.x-1][Playone.y]!=2)
{
if(map[Playone.x-1][Playone.y]==3)
continue;
DrawBlack(Playone.y,Playone.x);/*這個if是移動,前提是方向與按下的到向一致*/
Playone.x--;
Playone.direction=1;
DrawPlay(Playone.y,Playone.x);
}
else/*只調整炮頭方向*/
{
DrawBlack(Playone.y,Playone.x);
Playone.direction=1;
DrawPlay(Playone.y,Playone.x);
}
}
else if(GetKey(KEY_DOWN))/*往下*/
{
if(Playone.direction==3&&map[Playone.x+1][Playone.y]!=1&&map[Playone.x+1][Playone.y]!=2)
{
if(map[Playone.x+1][Playone.y]==3)
continue;
DrawBlack(Playone.y,Playone.x);
Playone.x++;
Playone.direction=3;
DrawPlay(Playone.y,Playone.x);
}
else
{
DrawBlack(Playone.y,Playone.x);
Playone.direction=3;
DrawPlay(Playone.y,Playone.x);
}
}
if(GetKey(KEY_RIGHT))/*往右*/
{
if(Playone.direction==2&&map[Playone.x][Playone.y+1]!=1&&map[Playone.x][Playone.y+1]!=2)
{
if(map[Playone.x][Playone.y+1]==3)
continue;
DrawBlack(Playone.y,Playone.x);
Playone.y++;
Playone.direction=2;
DrawPlay(Playone.y,Playone.x);
}
else
{
DrawBlack(Playone.y,Playone.x);
Playone.direction=2;
DrawPlay(Playone.y,Playone.x);
總結
以上是生活随笔為你收集整理的坦克大战c语言程序贴吧,坦克大战!的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C语言十个字母用冒泡法排序,冒泡排序法(
- 下一篇: linux tcmalloc,内存管理T