本文實例為大家分享了C#實現(xiàn)飛行棋游戲的具體代碼,供大家參考,具體內(nèi)容如下
游戲截圖:

管理類:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace ConsoleApp1{ class ProgramManage { //隨機數(shù) public static Random rd = new Random(); //定義地圖大小 public static int[] Maps = new int[100]; // public static bool[] PlayerPause = {false,false }; //定義玩家A和玩家B的坐標,0是玩家A的坐標;1是玩家B的坐標 public static int[] PlayerPos = new int[2]; //存儲兩個玩家的姓名 public static string[] PlayerName = new string[2]; //定義名字錯誤類型 public static string[] Error = {"正確","不能有數(shù)字","重名了","不能為空" }; //畫游戲頭 public static void GanmeShow() { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("*************************"); Console.WriteLine("********飛行棋游戲*******"); Console.WriteLine("*************************"); Console.ForegroundColor = ConsoleColor.Green; } //定義地圖關(guān)卡布局 public static void InitailMap() { int[] luckturn = { 6, 23, 40, 55, 69, 83 };//幸運輪盤◎ for (int i = 0; i < luckturn.Length; i++) { Maps[luckturn[i]] = 1; } int[] landMine = { 5, 13, 17, 33, 38, 50, 64, 80, 94 };//地雷× for (int i = 0; i < landMine.Length; i++) { Maps[landMine[i]] = 2; } int[] pause = { 9, 27, 60, 93 };//暫停▲ for (int i = 0; i < pause.Length; i++) { Maps[pause[i]] = 3; } int[] timeTunnel = { 20, 25, 45, 63, 72, 88, 90 };//時空隧道
主站蜘蛛池模板:
咸丰县|
务川|
临武县|
渭南市|
岳普湖县|
鄯善县|
和林格尔县|
白河县|
南充市|
黄大仙区|
龙山县|
新田县|
郎溪县|
富平县|
秀山|
孙吴县|
兰坪|
瓮安县|
锦屏县|
武汉市|
五大连池市|
琼中|
梧州市|
灵石县|
水城县|
如皋市|
中山市|
玉门市|
安仁县|
威信县|
土默特左旗|
六安市|
长丰县|
岳阳县|
广宁县|
赤壁市|
阳原县|
漯河市|
镇坪县|
航空|
沾化县|