飞行棋项目

特殊符号查询用搜狗输入法:


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();
                }
            }
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值