C++ 炸飞机小游戏

说明:

单机确定机头位置

然后鼠标滑轮 或左右键调整飞机方向

右键取消本次

回车键确定飞机 (确定后不能再右键)

 

代码部分: 

#include<graphics.h>
#include<iostream>
using namespace std;
#define gao 20//棋盘规格
#define kuan 20

#define fjgs 5//两边飞机个数

//棋盘初始化
int zuoqipan[gao][kuan] = { 0 };//飞机棋盘
int youqipan[gao][kuan] = { 0 };

int zuoqipan2[gao][kuan] = { 0 };//游戏棋盘
int youqipan2[gao][kuan] = { 0 };

//变量定义
ExMessage m;		// 定义消息变量
int x1=0,x2=0, y=0;//鼠标坐标
int S = 0;//操作标志位(画时1,2:进入飞机姿态确定)(玩时判断该轮到谁) 1为正在操作左棋盘  2为正在操作右棋盘
int fx = 0;//飞机预览方向标识位0为没有(生成失败、还未生成)shang1 you2 xia3 zuo4
int zfj=0, yfj=0;//左飞机个数、右飞机个数
int i2 = 0;//转向循环遍历变量

/*********************函数声明********************/
int zuobiaochuli1(int x);
int zuobiaochuli2(int x);
void dayinqipan(int a[gao][kuan], int b[gao][kuan]);
void Fjishen(int x, int y, int a);
void shang(int x, int y,int a);
void you(int x, int y, int a);
void xia(int x, int y, int a);
void zuo(int x, int y, int a);
void huafeiji(int a);
void youxi();

int main()
{
	initgraph(1509, 709);//建立一个宽为800像素,高为600像素的图形窗口。
	
	//IMAGE image5;
	//loadimage(&image5, L"5.png", 1509, 709);// 背景色
	//putimage(0, 0, &image5);//此三行取消注释后即可将5.png当背景色
	
	huafeiji(0);//写左棋盘
	huafeiji(1);//写右棋盘
	youxi();//进行游戏

	system("pause");
	return 0;
}


void youxi( )//a=0左棋盘   a=1右棋盘
{
	S = 0;
	IMAGE image6;
	loadimage(&image6, L"6.png", 32, 32);
	IMAGE image7;
	loadimage(&image7, L"7.png", 32, 32);
	putimage(709, 6, &image6);
	while (1)
	{
		m = getmessage(EM_MOUSE | EM_KEY);//捕获鼠标操作
		flushmessage(EM_KEY);
		if (m.lbutton == 1)
		{
			if (S == 0 && m.x < 703 && m.x>6 && m.y > 6 && m.y < 706)//当鼠标在左棋盘范围内时操作左棋盘
			{
				x1 = zuobiaochuli1(m.x); y = zuobiaochuli1(m.y);//将鼠标坐标转化为数组下标		左棋盘用x1、右棋盘用x2
				if (x1 != 999 && y != 999)//当鼠标坐标在格点上时(不在格点间的缝隙上)
				{
					if (zuoqipan[x1][y] == 0 && zuoqipan2[x1][y] ==0)//加 && zuoqipan2[x1][y] = = 0是让被点开的地方不能再被点一次
					{ zuoqipan2[x1][y] = 3; S=1;}
					else if (zuoqipan[x1][y] == 1 && zuoqipan2[x1][y] == 0)
					{ zuoqipan2[x1][y] = 1; S = 1; }
					else if (zuoqipan[x1][y] == 2 && zuoqipan2[x1][y] == 0)
					{
						zuoqipan2[x1][y] = 2;
						zfj--; 
						S = 1;
							if (zfj == 0) 
							{ 
								dayinqipan(zuoqipan2, youqipan2);
								return;
							}
					}
				}
			}
		


			else if (S == 1 && m.x > 806 && m.y > 6 && m.x < 1503 && m.y < 706)
			{
				x2 = zuobiaochuli2(m.x); y = zuobiaochuli1(m.y);//将鼠标坐标转化为数组下标
				if (x2 != 999 && y != 999)//当鼠标坐标在格点上时(不在格点间的缝隙上)
				{
					if (youqipan[x2][y] == 0 && youqipan2[x2][y] == 0) //加 && zuoqipan2[x1][y] = = 0是让被点开的地方不能再被点一次
					{ youqipan2[x2][y] = 3; S = 0; }
					else if (youqipan[x2][y] == 1 && youqipan2[x2][y] == 0) 
					{ youqipan2[x2][y] = 1; S = 0; }
					else if (youqipan[x2][y] == 2 && youqipan2[x2][y] == 0)
					{ 
						youqipan2[x2][y] = 2;
						yfj--;
						S = 0;
							if (yfj == 0)
							{
								dayinqipan(zuoqipan2, youqipan2);
								return;
							}
					}
				}
			}

		}
		if (S == 1) { putimage(768, 6, &image6);  putimage(709, 6, &image7); }
		else if (S == 0) { putimage(709, 6, &image6); putimage(768, 6, &image7); }
		dayinqipan(zuoqipan2, youqipan2);//打印棋盘
	}
}

void huafeiji(int a)//0左棋盘 1右棋盘
{
	while (1)
	{
		m = getmessage(EM_MOUSE | EM_KEY);//捕获鼠标操作
		flushmessage(EM_KEY);
		if (m.lbutton == 1 && S == 0)//鼠标左键点下 并且在定义机头位置的状态(非定义机身方向的状态)
		{

			if (a == 0 && m.x < 703 && m.x>6 && m.y > 6 && m.y < 706)//当鼠标在左棋盘范围内时操作左棋盘
			{
				x1 = zuobiaochuli1(m.x); y = zuobiaochuli1(m.y);//将鼠标坐标转化为数组下标		左棋盘用x1、右棋盘用x2
				if (x1 != 999 && y != 999 && zuoqipan[x1][y] ==0)//当鼠标坐标在格点上且不在机身上时(不在格点间的缝隙上)
				{
					zuoqipan[x1][y] = 2;//所点位置为机头
					S = 1;// 若定义完机头设置标志位为1,机头在左半图被定义 并将要在左半图确定飞机姿态
					fx = 0;
					shang(x1, y, 0);//在机头上方生成机身
					if (fx == 0)you(x1, y, 0);//若生成失败则尝试下一个方向
					if (fx == 0)xia(x1, y, 0);
					if (fx == 0)zuo(x1, y, 0);
					if (fx == 0) { zuoqipan[x1][y] = 0; S = 0; }//若所有方向都生成失败则将机头消除
				}

			}

			else if (a == 1 && m.x > 806 && m.y > 6 && m.x < 1503 && m.y < 706)
			{
				x2 = zuobiaochuli2(m.x); y = zuobiaochuli1(m.y);//将鼠标坐标转化为数组下标
				if (x2 != 999 && y != 999 && youqipan[x2][y] ==0)//当鼠标坐标在格点上时(不在格点间的缝隙上)
				{
					youqipan[x2][y] = 2;//所点位置为机头
					S = 2;// 若定义完机头设置标志位
					fx = 0;
					shang(x2, y, 1);//在机头上方生成机身
					if (fx == 0)you(x2, y, 1);//若生成失败则尝试下一个方向
					if (fx == 0)xia(x2, y, 1);
					if (fx == 0)zuo(x2, y, 1);
					if (fx == 0) { youqipan[x2][y] = 0; S = 0; }//若所有方向都生成失败则将机头消除
				}
			}
		}


		else if (m.rbutton == 1 && S != 0)//鼠标右键(清除当前选择和预览)  当m.rbutton == 1且S!=0 且m.lbutton != 1时 即右键点下且左键没点下且机头已经定义 
		{
			if (S == 1) //(左棋盘)
			{
				zuoqipan[x1][y] = 0;//清除机头预览
				Fjishen(x1, y, 0);//清除机身预览
				fx = 0;
				S = 0;
			}


			else if (S == 2)//(右棋盘)
			{
				youqipan[x2][y] = 0;
				Fjishen(x2, y, 1);
				fx = 0;
				S = 0;
			}
		}



		else if (m.vkcode == VK_RETURN && S != 0 && m.message == WM_KEYDOWN)//按下回车键确定飞机		 并开始新机头的定位模式
		{
			S = 0;
			if (a == 0)
			{
				zfj++;
				if (zfj == fjgs) { dayinqipan(zuoqipan2, youqipan2); return; }//隐藏所画并退出设置飞机函数
			}
			else if (a == 1)
			{
				yfj++;
				if (yfj == fjgs) { dayinqipan(zuoqipan2, youqipan2); return; }//隐藏所画并退出设置飞机函数
			}
		}



		else if (S != 0 && (m.wheel == 120 || m.vkcode == VK_LEFT && m.message == WM_KEYDOWN))//鼠标滚轮上划、左移键操作  	
		{
			if (S == 1)//左棋盘
			{
				i2 = fx - 1;//将i2的值赋为fx的下一个状态 上划为减1 下滑为加一
				Fjishen(x1, y, 0);//删除当前fx的预览
				while (1)//用循环遍历
				{
					if (i2 <= 0)i2 = 4;//越界时纠正
					switch (i2)//尝试打印下一个状态(i2)
					{
					case 1: shang(x1, y, 0); break;
					case 2: you(x1, y, 0); break;
					case 3: xia(x1, y, 0); break;
					case 4: zuo(x1, y, 0); break;
					}
					if (i2 == fx)break;//若打印成功则退出
					i2--;
				}
			}

			if (S == 2)//右棋盘
			{
				i2 = fx - 1;
				Fjishen(x2, y, 1);
				while (1)
				{
					if (i2 <= 0)i2 = 4;
					switch (i2)
					{
					case 1: shang(x2, y, 1); break;
					case 2: you(x2, y, 1); break;
					case 3: xia(x2, y, 1); break;
					case 4: zuo(x2, y, 1); break;
					}
					if (i2 == fx)break;
					i2--;
				}
			}
		}

		else if (S != 0 && (m.wheel == -120 || m.vkcode == VK_RIGHT && m.message == WM_KEYDOWN))//鼠标滚轮下划、右移键操作  仅按下时生效 否则按下松开会执行两次代码
		{
			if (S == 1)//左棋盘
			{
				i2 = fx + 1;
				Fjishen(x1, y, 0);
				while (1)
				{
					if (i2 >= 5)i2 = 1;
					switch (i2)
					{
					case 1: shang(x1, y, 0); break;
					case 2: you(x1, y, 0); break;
					case 3: xia(x1, y, 0); break;
					case 4: zuo(x1, y, 0); break;
					}
					if (i2 == fx)break;
					i2++;
				}
			}
			if (S == 2)//右棋盘
			{
				i2 = fx + 1;
				Fjishen(x2, y, 1);
				while (1)
				{
					if (i2 >= 5)i2 = 1;
					switch (i2)
					{
					case 1: shang(x2, y, 1); break;
					case 2: you(x2, y, 1); break;
					case 3: xia(x2, y, 1); break;
					case 4: zuo(x2, y, 1); break;
					}
					if (i2 == fx)break;
					i2++;
				}
			}
		}

		if(a==0)dayinqipan(zuoqipan, youqipan2);//打印棋盘
		else if(a==1)dayinqipan(zuoqipan2, youqipan);//打印棋盘

	}
}
void dayinqipan(int a[gao][kuan], int b[gao][kuan])
{				 //数组值        含义
	IMAGE image1;//0		未定义、未揭示区域
	IMAGE image2;//1		机身
	IMAGE image3;//2		机头
	IMAGE image4;//3		被揭示且不是机头或机身
	loadimage(&image1, L"1.png", 32,32);
	loadimage(&image2, L"2.png", 32, 32);
	loadimage(&image3, L"3.png", 32, 32);
	loadimage(&image4, L"4.png", 32, 32);
	for (int i = 0; i < gao; i++)
		for (int j = 0; j < kuan; j++)
		{
			if(a[i][j]==0)
			putimage(i * 35 + 6, j * 35 + 6, &image1);// 将image1显示在所创立的图形窗口的(,)处
			else if(a[i][j]==1)
				putimage(i * 35 + 6, j * 35 + 6, &image2);// 将image1显示在所创立的图形窗口的(,)处
			else if (a[i][j] == 2)
				putimage(i * 35 + 6, j * 35 + 6, &image3);
			else if (a[i][j] == 3)
				putimage(i * 35 + 6, j * 35 + 6, &image4);
		}

	for (int i = 0; i < gao; i++)
		for (int j = 0; j < kuan; j++)
		{
			if(b[i][j]==0)
			putimage(i * 35 + 806, j * 35 + 6, &image1);// 将image1显示在所创立的图形窗口的(,)处
			else if(b[i][j] == 1)
				putimage(i * 35 + 806, j * 35 + 6, &image2);
			else if (b[i][j] == 2)
				putimage(i * 35 + 806, j * 35 + 6, &image3);
			else if (b[i][j] == 3)
				putimage(i * 35 + 806, j * 35 + 6, &image4);
		}
}



int zuobiaochuli1(int x)//将像素、坐标转化为对应的格点
{
	double ida=(x-6)*1.0/35,ixiao=(x-38)*1.0/35;
	for (int i = (int)ixiao; i <= (int)(ida + 0.501); i++)
		if (i <= ida && i >= ixiao)return i;

	return 999;
}

int zuobiaochuli2(int x)
{
	double ida = (x - 806) * 1.0 / 35, ixiao = (x - 838) * 1.0 / 35;
	for (int i = (int)ixiao; i <= (int)(ida + 0.6); i++)
		if (i <= ida && i >= ixiao)return i;

	return 999;
}



/*************************************************************生成机身----删除机身********************************************/
void shang(int x, int y, int a)//在机头上方生成机身 参数:	x:机头x坐标、y:机头y坐标、a:0为操作左棋盘 1为操作右棋盘
{
	if (a == 0)//左棋盘
	{
		if (x - 2 >= 0 && x + 2 <= 19 && y - 3 >= 0)//判断将要生成的机身是否出界
			if (zuoqipan[x][y - 1] + zuoqipan[x - 1][y - 1] + zuoqipan[x - 2][y - 1] + zuoqipan[x + 1][y - 1] + zuoqipan[x + 2][y - 1] + zuoqipan[x][y - 2] + zuoqipan[x][y - 3] + zuoqipan[x - 1][y - 3] + zuoqipan[x + 1][y - 3] == 0)
			{//判断机身是否与其他飞机重叠
				zuoqipan[x][y - 1] = 1;//生成机身
				zuoqipan[x - 1][y - 1] = 1;
				zuoqipan[x - 2][y - 1] = 1;
				zuoqipan[x + 1][y - 1] = 1;
				zuoqipan[x + 2][y - 1] = 1;
				zuoqipan[x][y - 2] = 1;
				zuoqipan[x][y - 3] = 1;
				zuoqipan[x - 1][y - 3] = 1;
				zuoqipan[x + 1][y - 3] = 1;
				fx = 1;//生成完赋值方向标志
			}
			
	}
	else if (a == 1)//右棋盘
	{
		if (x - 2 >= 0 && x + 2 <= 19 && y - 3 >= 0)
			if(youqipan[x][y - 1] + youqipan[x - 1][y - 1] + youqipan[x - 2][y - 1] + youqipan[x + 1][y - 1] + youqipan[x + 2][y - 1] + youqipan[x][y - 2] + youqipan[x][y - 3] + youqipan[x - 1][y - 3] + youqipan[x + 1][y - 3] == 0)
			{
				youqipan[x][y - 1] = 1;
				youqipan[x - 1][y - 1] = 1;
				youqipan[x - 2][y - 1] = 1;
				youqipan[x + 1][y - 1] = 1;
				youqipan[x + 2][y - 1] = 1;
				youqipan[x][y - 2] = 1;
				youqipan[x][y - 3] = 1;
				youqipan[x - 1][y - 3] = 1;
				youqipan[x + 1][y - 3] = 1;
				fx = 1;
			}
	}
}

void you(int x, int y, int a)//在机头右方生成机身 参数:	x:机头x坐标、y:机头y坐标、a:0为操作左棋盘 1为操作右棋盘

{
	if (a == 0)
	{
		if (y + 2 <= 19 && x + 3 <= 19 && y - 2 >= 0)
			if (zuoqipan[x + 1][y] +zuoqipan[x + 1][y + 1] +zuoqipan[x + 1][y + 2] +zuoqipan[x + 1][y - 1] +zuoqipan[x + 1][y - 2] +zuoqipan[x + 2][y] +zuoqipan[x + 3][y] +zuoqipan[x + 3][y + 1] +zuoqipan[x + 3][y - 1] == 0)
			{
				zuoqipan[x + 1][y] = 1;
				zuoqipan[x + 1][y + 1] = 1;
				zuoqipan[x + 1][y + 2] = 1;
				zuoqipan[x + 1][y - 1] = 1;
				zuoqipan[x + 1][y - 2] = 1;
				zuoqipan[x + 2][y] = 1;
				zuoqipan[x + 3][y] = 1;
				zuoqipan[x + 3][y + 1] = 1;
				zuoqipan[x + 3][y - 1] = 1;
				fx = 2;
			}
	}
	else if (a == 1)
	{
		if (y + 2 <= 19 && x + 3 <= 19 && y - 2 >= 0)
			if (youqipan[x + 1][y] + youqipan[x + 1][y + 1] + youqipan[x + 1][y + 2] + youqipan[x + 1][y - 1] + youqipan[x + 1][y - 2] + youqipan[x + 2][y] + youqipan[x + 3][y] + youqipan[x + 3][y + 1] + youqipan[x + 3][y - 1] == 0)
			{
				youqipan[x + 1][y] = 1;
				youqipan[x + 1][y + 1] = 1;
				youqipan[x + 1][y + 2] = 1;
				youqipan[x + 1][y - 1] = 1;
				youqipan[x + 1][y - 2] = 1;
				youqipan[x + 2][y] = 1;
				youqipan[x + 3][y] = 1;
				youqipan[x + 3][y + 1] = 1;
				youqipan[x + 3][y - 1] = 1;
				fx = 2;
			}
	}
}

void xia(int x, int y, int a)//在机头下方生成机身 参数:	x:机头x坐标、y:机头y坐标、a:0为操作左棋盘 1为操作右棋盘
{
	if (a == 0)
	{
		if (x - 2 >= 0 && x + 2 <= 19 && y + 3 <= 19)
			if (zuoqipan[x][y + 1] + zuoqipan[x - 1][y + 1] + zuoqipan[x - 2][y + 1] + zuoqipan[x + 1][y + 1] + zuoqipan[x + 2][y + 1] + zuoqipan[x][y + 2] + zuoqipan[x][y + 3] + zuoqipan[x - 1][y + 3] + zuoqipan[x + 1][y + 3] == 0)
			{
				zuoqipan[x][y + 1] = 1;
				zuoqipan[x - 1][y + 1] = 1;
				zuoqipan[x - 2][y + 1] = 1;
				zuoqipan[x + 1][y + 1] = 1;
				zuoqipan[x + 2][y + 1] = 1;
				zuoqipan[x][y + 2] = 1;
				zuoqipan[x][y + 3] = 1;
				zuoqipan[x - 1][y + 3] = 1;
				zuoqipan[x + 1][y + 3] = 1;
				fx = 3;
			}
	}
	else if (a == 1)
	{
		if (x - 2 >= 0 && x + 2 <= 19 && y + 3 <= 19)
			if (youqipan[x][y + 1] + youqipan[x - 1][y + 1] + youqipan[x - 2][y + 1] + youqipan[x + 1][y + 1] + youqipan[x + 2][y + 1] + youqipan[x][y + 2] + youqipan[x][y + 3] + youqipan[x - 1][y + 3] + youqipan[x + 1][y + 3] == 0)
			{
				youqipan[x][y + 1] = 1;
				youqipan[x - 1][y + 1] = 1;
				youqipan[x - 2][y + 1] = 1;
				youqipan[x + 1][y + 1] = 1;
				youqipan[x + 2][y + 1] = 1;
				youqipan[x][y + 2] = 1;
				youqipan[x][y + 3] = 1;
				youqipan[x - 1][y + 3] = 1;
				youqipan[x + 1][y + 3] = 1;
				fx = 3;
			}
	}
}

void zuo(int x, int y, int a)//在机头左方生成机身 参数:	x:机头x坐标、y:机头y坐标、a:0为操作左棋盘 1为操作右棋盘
{
	if (a == 0)
	{
		if (y + 2 <= 19 && x - 3 >= 0 && y - 2 >= 0)
			if (zuoqipan[x - 1][y]+	zuoqipan[x - 1][y - 1] +zuoqipan[x - 1][y - 2]+	zuoqipan[x - 1][y + 1]+	zuoqipan[x - 1][y + 2] +zuoqipan[x - 2][y]+	zuoqipan[x - 3][y]+zuoqipan[x - 3][y - 1] +zuoqipan[x - 3][y + 1]  == 0)
			{
				zuoqipan[x - 1][y] = 1;
				zuoqipan[x - 1][y - 1] = 1;
				zuoqipan[x - 1][y - 2] = 1;
				zuoqipan[x - 1][y + 1] = 1;
				zuoqipan[x - 1][y + 2] = 1;
				zuoqipan[x - 2][y] = 1;
				zuoqipan[x - 3][y] = 1;
				zuoqipan[x - 3][y - 1] = 1;
				zuoqipan[x - 3][y + 1] = 1;
				fx = 4;
			}
	}
	else if (a == 1)
	{
		if (y + 2 <= 19 && x - 3 >= 0 && y - 2 >= 0)
			if (youqipan[x - 1][y] + youqipan[x - 1][y - 1] + youqipan[x - 1][y - 2] + youqipan[x - 1][y + 1] + youqipan[x - 1][y + 2] + youqipan[x - 2][y] + youqipan[x - 3][y] + youqipan[x - 3][y - 1] + youqipan[x - 3][y + 1] == 0)
			{
				youqipan[x - 1][y] = 1;
				youqipan[x - 1][y - 1] = 1;
				youqipan[x - 1][y - 2] = 1;
				youqipan[x - 1][y + 1] = 1;
				youqipan[x - 1][y + 2] = 1;
				youqipan[x - 2][y] = 1;
				youqipan[x - 3][y] = 1;
				youqipan[x - 3][y - 1] = 1;
				youqipan[x - 3][y + 1] = 1;
				fx = 4;
			}
	}
}

void Fjishen(int x, int y,int a)//取消机身	参数:	x:机头x坐标、y:机头y坐标、a:0为操作左棋盘 1为操作右棋盘
{
	if (a == 0)
	{
		switch (fx)//根据当前方位取消
		{
			case 1:
			{
				zuoqipan[x][y - 1] = 0;
				zuoqipan[x - 1][y - 1] = 0;
				zuoqipan[x - 2][y - 1] = 0;
				zuoqipan[x + 1][y - 1] = 0;
				zuoqipan[x + 2][y - 1] = 0;
				zuoqipan[x][y - 2] = 0;
				zuoqipan[x][y - 3] = 0;
				zuoqipan[x - 1][y - 3] = 0;
				zuoqipan[x + 1][y - 3] = 0;
				
			}break;

			case 2:
			{
				zuoqipan[x + 1][y] = 0;
				zuoqipan[x + 1][y + 1] = 0;
				zuoqipan[x + 1][y + 2] = 0;
				zuoqipan[x + 1][y - 1] = 0;
				zuoqipan[x + 1][y - 2] = 0;
				zuoqipan[x + 2][y] = 0;
				zuoqipan[x + 3][y] = 0;
				zuoqipan[x + 3][y + 1] = 0;
				zuoqipan[x + 3][y - 1] = 0;
				
			}break;

			case 3: 
			{
				zuoqipan[x][y + 1] = 0;
				zuoqipan[x - 1][y + 1] = 0;
				zuoqipan[x - 2][y + 1] = 0;
				zuoqipan[x + 1][y + 1] = 0;
				zuoqipan[x + 2][y + 1] = 0;
				zuoqipan[x][y + 2] = 0;
				zuoqipan[x][y + 3] = 0;
				zuoqipan[x - 1][y + 3] = 0;
				zuoqipan[x + 1][y + 3] = 0;
				
			}break;

			case 4:
			{
				zuoqipan[x - 1][y] = 0;
				zuoqipan[x - 1][y - 1] = 0;
				zuoqipan[x - 1][y - 2] = 0;
				zuoqipan[x - 1][y + 1] = 0;
				zuoqipan[x - 1][y + 2] = 0;
				zuoqipan[x - 2][y] = 0;
				zuoqipan[x - 3][y] = 0;
				zuoqipan[x - 3][y - 1] = 0;
				zuoqipan[x - 3][y + 1] = 0;
				
			}break;

		}
		
		
	}
	else if (a == 1)
	{
		switch (fx)
		{
			case 1:
			{
				youqipan[x][y - 1] = 0;
				youqipan[x - 1][y - 1] = 0;
				youqipan[x - 2][y - 1] = 0;
				youqipan[x + 1][y - 1] = 0;
				youqipan[x + 2][y - 1] = 0;
				youqipan[x][y - 2] = 0;
				youqipan[x][y - 3] = 0;
				youqipan[x - 1][y - 3] = 0;
				youqipan[x + 1][y - 3] = 0;
				
			}break;

			case 2:
			{
				youqipan[x + 1][y] = 0;
				youqipan[x + 1][y + 1] = 0;
				youqipan[x + 1][y + 2] = 0;
				youqipan[x + 1][y - 1] = 0;
				youqipan[x + 1][y - 2] = 0;
				youqipan[x + 2][y] = 0;
				youqipan[x + 3][y] = 0;
				youqipan[x + 3][y + 1] = 0;
				youqipan[x + 3][y - 1] = 0;
				
			}break;

			case 3:
			{
				youqipan[x][y + 1] = 0;
				youqipan[x - 1][y + 1] = 0;
				youqipan[x - 2][y + 1] = 0;
				youqipan[x + 1][y + 1] = 0;
				youqipan[x + 2][y + 1] = 0;
				youqipan[x][y + 2] = 0;
				youqipan[x][y + 3] = 0;
				youqipan[x - 1][y + 3] = 0;
				youqipan[x + 1][y + 3] = 0;
				
			}break;

			case 4:
			{
				youqipan[x - 1][y] = 0;
				youqipan[x - 1][y - 1] = 0;
				youqipan[x - 1][y - 2] = 0;
				youqipan[x - 1][y + 1] = 0;
				youqipan[x - 1][y + 2] = 0;
				youqipan[x - 2][y] = 0;
				youqipan[x - 3][y] = 0;
				youqipan[x - 3][y - 1] = 0;
				youqipan[x - 3][y + 1] = 0;
				
			}break;

		}


	}
}

  • 8
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Zx62365

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值