C#实现飞行棋项目实现飞行棋项目
本文实例为大家分享了C#实现飞行棋项目的具体代码,供大家参考,具体内容如下
1.制作游戏头部:游戏头部介绍制作游戏头部:游戏头部介绍
2.绘制地图绘制地图
使用一维数组装整个地图的路线
如果这个位置是0,绘制普通格子□
如果这个位置是1,绘制幸运轮盘◎
如果这个位置是2,绘制地雷★
如果这个位置是3,绘制暂停▲
如果这个位置是4,绘制时空隧道卍
规划幸运轮盘位置
int[] luckyturn = { 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 };
3.设置特殊关卡设置特殊关卡
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 飞行棋
{
class Program
{
/// <summary>
/// 整个地图数组
/// </summary>
static int[] Maps = new int[100];
/// <summary>
/// 玩家的位置
/// </summary>
static int[] PlayerPos = new int[2];
/// <summary>
/// 玩家的姓名
/// </summary>
static string[] PlayerName = new string[2];
/// <summary>
/// 记录两名玩家是否可以掷骰子
/// </summary>
static bool[] PlayerFlag = new bool[2];
static void Main(string[] args)
{
//绘制地图头部
ShowTitle();
//输入玩家姓名
Console.WriteLine("请输入玩家A的姓名");
PlayerName[0]=Console.ReadLine();
while (PlayerName[0]=="")
{
Console.WriteLine("玩家A姓名不能为空,请重新输入");
PlayerName[0]=Console.ReadLine();
}
Console.WriteLine("请输入玩家B的姓名");
PlayerName[1] = Console.ReadLine();
while (PlayerName[1]=="" || PlayerName[1]==PlayerName[0])
评论0
最新资源