飞行棋游戏
1.画游戏头
public static void GameHead()
{
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("**************************");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("**************************");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("**************************");
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("*******飞行棋游戏*********");
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("**************************");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("**************************");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("**************************");
}
新学知识:
Console.ForegroundColor = ConsoleColor.Cyan; 用于设置前景色
2.初始化地图
public static int[] Maps=new int[100];//声明一个静态的字段且长度为100的数组且该数组的初值为0
public static void InitialMap()
{
int[] luckyturn={6,2,40,55,69,83};//声明luckyturn的数组下标
for(int i=0;i<luckyturn.Length;i++)
{
Maps[lckyturn[i]]=1;
}
int[] landMine{5,13,17,33,38,50,64,80,94};
for(int i=0;i<landMine.Length;i++)
{
Maps[landMine[i]]=1;
}
int[] pause{9,27,60,93};
for(int i=0;i<pause.Length;i++)
{
Maps[pause[i]]=1;
}
int[] timeTunnel={20,25,45,63,72,88,90};
for(int i=0;i<timeTunnel.Length;i++)
{
Maps[timeTunnel[i]]=1;
}
}