特殊符号查询用搜狗输入法:
1、画游戏头
2、初始化地图(加载地图所需要的资源)
将整数数组中的数字变成控制台中显示的特殊字符串的这个过程,就是初始化地图
3、画地图
4、玩游戏
游戏规则:
如果玩家A踩到了玩家B,玩家B退6格
踩到了地雷,退6格
踩到了时空隧道,进10格
踩到了幸运轮盘,1 交换位置 2 轰炸对方,使对方退6格
踩到了暂停,暂停一回合
踩到了方块 什么都不干
◎ ☆ ▲ 卐
Map[50]
if(map[40]==1)
{
Console.WriteLine("◎");
}
//初始化地图 Map[6]=1
//我用0表示普通,显示给用户就是□
//...1...幸运转盘,显示给用户就是◎
//...2...地雷,显示给用户就是☆
//...3...暂停,显示给用户就是▲
//...4...时空隧道,显示给用户就是卐
int[] luckturn = {6,23,40,55,69,83};//幸运转盘◎
int[] landMine = {5,13,17,33,38,50,64,80,94};//地雷☆
int[] pause = {9,27,60,93};//暂停▲
int[] timeTunnel = {20,25,45,63,72,88,90};//时空隧道
for(int i = 0;i<luckturn.Length;i++)
{
int n = luckturn[i];
Map[n] = 1;
}
for(int = 0;i<landMine.Length;i++)
{
int n = landMine[i];
Map[n] = 1;
}
项目运行截图:
项目代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 飞行棋游戏
{
class Program
{
//静态字段 模拟全局变量
static int[] Maps = new int[100];
//生命一个静态数组用来存储玩家A跟玩家B的坐标
static int[] PlayerPos = new int[2];
//存储两个玩家的姓名
static string[] PlayerNames = new string[2];
//两个玩家的标记
//Flags[0]默认是false,Flags[1]默认也是false
static bool[] Flags = new bool[2];
static void Main(string[] args)
{
GameShow();
#region 输入玩家姓名
Console.WriteLine("请输入玩家A的姓名:");
PlayerNames[0] = Console.ReadLine();
while (PlayerNames[0] == "")
{
Console.WriteLine("玩家A的姓名不能为空,请重新输入");
PlayerNames[0] = Console.ReadLine();
}
Console.WriteLine("请输入玩家B的姓名:");
PlayerNames[1] = Console.ReadLine();
while (PlayerNames[1] == "" || PlayerNames[1] == PlayerNames[0])
{
if (PlayerNames[1] == "")
{
Console.WriteLine("玩家B的姓名不能为空,请重新输入");
PlayerNames[1] = Console.ReadLine();
}
else
{
Console.WriteLine("玩家B的姓名不能与A相同,请重新输入");
PlayerNames[1] = Console.ReadLine();
}
}