• 大小: 47KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-15
  • 语言: C#
  • 标签: c#  飞行棋  代码  

资源简介

c#飞行棋游戏的代码资源,是C#基础(10)——飞行棋游戏的

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ChuangzhiConsel
{

    class Program
    {
        //声明全局地图
        public static int[] Map = new int[100];
        //声明全局玩家坐标
        public static int[] PlayerPos = new int[2];
        //声明全局玩家名称
        public static string[] PlayerName = new string[2];
        //启动哪个玩家标记,默认初始值false
        public static bool[] Pause_Falgs = new bool[2];
        static void Main(string[] args)
        {
            GameShow();
            #region #输入玩家姓名
            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])
            {
                if (PlayerName[0] == PlayerName[1])
                {
                    Console.WriteLine(“B玩家不能与A玩家重名,请重新输入:“);
                    PlayerName[1] = Console.ReadLine();
                }
                else
                {
                    Console.WriteLine(“B玩家不能为空,请重新输入:“);
                    PlayerName[1] = Console.ReadLine();
                }
            }
            #endregion
            Console.Clear();
            GameShow();
            Console.WriteLine(“{0}的玩家用A表示,{1}的玩家用B表示。“ PlayerName[0] PlayerName[1]);
            InitialMap();
            DrawMap();

            #region #游戏开始
            while (PlayerPos[0] < (Map.Length - 1) && PlayerPos[1] < (Map.Length - 1))
            {
                if (Pause_Falgs[0] == false)
                {
                    PlayGames(0);
                }
                else
                {
                    Pause_Falgs[0] = false;
                }
                if (PlayerPos[0] >= 99)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(“恭喜玩家【{0}】赢得了比赛!!!“ PlayerName[0]);
                    Console.ReadKey(true);
                    break;
                }
               
                if (Pause_Falgs[1] == false)
                {
                    PlayGames(1);
                }
                else
                {
                    Pause_Falgs[1] = false;
                }
                if (PlayerPos[1] >= 99)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(“恭喜玩家【{0}】赢得了比赛!!!“ PlayerName[1]);
                    Console.ReadKey(true);
                    break;
                }
               
            }
            #endregion
            Win();
            Console.ReadKey();
        }

        /// 


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-10-21 19:28  ChuangzhiConsel\
     目录           0  2017-10-29 20:42  ChuangzhiConsel\ChuangzhiConsel\
     文件        1014  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel.sln
     文件       31232  2017-10-29 20:52  ChuangzhiConsel\ChuangzhiConsel.v12.suo
     文件         187  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\App.config
     目录           0  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\bin\
     目录           0  2017-10-21 21:15  ChuangzhiConsel\ChuangzhiConsel\bin\Debug\
     文件       11264  2017-10-29 20:42  ChuangzhiConsel\ChuangzhiConsel\bin\Debug\ChuangzhiConsel.exe
     文件         187  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\bin\Debug\ChuangzhiConsel.exe.config
     文件       19968  2017-10-29 20:42  ChuangzhiConsel\ChuangzhiConsel\bin\Debug\ChuangzhiConsel.pdb
     文件       23168  2017-10-29 20:45  ChuangzhiConsel\ChuangzhiConsel\bin\Debug\ChuangzhiConsel.vshost.exe
     文件         187  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\bin\Debug\ChuangzhiConsel.vshost.exe.config
     文件         490  2015-06-04 12:48  ChuangzhiConsel\ChuangzhiConsel\bin\Debug\ChuangzhiConsel.vshost.exe.manifest
     文件        2572  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\ChuangzhiConsel.csproj
     目录           0  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\obj\
     目录           0  2017-10-29 20:42  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\
     文件         604  2017-10-29 20:45  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\ChuangzhiConsel.csproj.FileListAbsolute.txt
     文件        1755  2017-10-21 21:15  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\ChuangzhiConsel.csprojResolveAssemblyReference.cache
     文件       11264  2017-10-29 20:42  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\ChuangzhiConsel.exe
     文件       19968  2017-10-29 20:42  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\ChuangzhiConsel.pdb
     文件         712  2017-10-25 15:35  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6628  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件           0  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
     文件           0  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
     文件           0  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
     目录           0  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\obj\Debug\TempPE\
     文件       15174  2017-10-29 20:42  ChuangzhiConsel\ChuangzhiConsel\Program.cs
     目录           0  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\Properties\
     文件        1354  2017-10-21 19:28  ChuangzhiConsel\ChuangzhiConsel\Properties\AssemblyInfo.cs

评论

共有 条评论