C 實現簡單的飛行棋遊戲

2022-09-28 08:15:07 字數 3852 閱讀 7320

下面展示 完整**:

namespace 飛行棋

的士兵用a表示\n的士兵用a表示", playername[0], playername[1]);

initailmap();

drawmap();

while (playerpos[0] < 99 && playerpos[1] < 99)

勝利",playername[i]);}}

win();

console.readkey();

}///

/// 遊戲開始提示

///

public static void gamestart()

///

/// 玩家資訊輸入

///

public static void mes()

console.writeline("請輸入玩家b的姓名");

playername[1] = console.readline();

while (playername[1] == " " || playername[0] == playername[1])

}///

/// 初始化地圖

///

public static void initailmap()

;int landmine = ;

int pause = ;

int timetunnel = ;

foreach (int i in luckyturn)

maps[i] = 1;

foreach (int i in landmine)

maps[i] = 2;

foreach (int i in pause)

maps[i] = 3;

foreach (int i in timetunnel)

maps[i] = 4;

}///

/// 實現數字與特殊字元的轉換

///

public static void drawmap()

#endregion

#region 第二橫行

for (i = 64; i >= 35; i--)

console.write(draw(i));

console.writeline();

#endregion

#region 第二豎行

for (i=65; i < 70; i++)

#endregion

#region 第三橫行

for (; i<100; i++)

console.write(draw(i));

#endregion

console.writeline();

}///

/// 將陣列轉換為特殊字元

///

///

///

public static string draw(int i)

else if (playerpos[0] == i)

else if (playerpos[1] == i)

else

}return str;

}///

/// 遊戲進行**段

///

///

public static void playgame(int playernumber)

按任意鍵開始擲骰子", playername[playernumber]);

console.readkey(true);

int n = r.next(1,7);

console.writeline("擲出了", playername[playernumber], n);

playerpos[playernumber] += n;

changepos();

console.readkey(true);

console.writeline("按任意鍵開始行動", playername[playernumber]);

console.readkey(true);

console.writeline("行動結束", playername[playernumber]);

console.readkey(true);

if (playerpos[playernumber] == playerpos[1- playernumber])

踩到了玩家,玩家後退六格", playername[playernumber], playername[1- playernumber], playername[1- playernumber]);

playerpos[1] -= 6;

console.readkey(true);

}else

正常", playername[playernumber]);

console.readkey(true);

break;

case 1:

console.writeline("玩家踩到了幸運圓盤,有以下兩個選擇:1.雙方交換位置,2.對方後退六格",playername[playernumber]);

while (true)

選擇交換位置", playername[playernumber]);

console.readkey(true);

int temp;

temp = playerpos[playernumber];

playerpos[playernumber] = playerpos[1- playernumber];

playerpos[1- playernumber] = temp;

console.writeline("交換成功,按任意鍵繼續遊戲");

console.readkey(true);

break;

}else if (input == "2")

選擇轟炸對方", playername[playernumber]);

console.readkey(true);

playerpos[1- playernumber] -= 6;

console.readkey(true);

break;

}else

}break;

case 2:

console.writeline("玩家踩到了地雷,退六格", playername[playernumber]);

console.readkey(true);

www.cppcns.com playerpos[playernumber] -= 6;

break;

case 3:

console.writeline("玩家踩到了暫停,暫停一回合", playername[playernumber]);

flags[playernumber] = true;

console.readkey(true);

break;

case 4:

console.writeline("玩家踩到了時空隧道,前進十格", playername[playernumber]);

playerpos[playernumber] += 10;

console.readkey(true);

break;}}

changepos();

console.clear();

drawmap();

}///

/// 當玩家座標發生改變時呼叫

///

public static void changepos()

public static void win()}}

本文標題: c#實現簡單的飛行棋遊戲

本文位址:

C 飛行棋遊戲

1 using system 2using system.collections.generic 3using system.linq 4using system.text 5using system.threading.tasks 67 namespace 05.飛行棋遊戲834 35 conso...

C 實現飛行棋小遊戲

邏輯圖以下是擲色子的乙個 比較有代表性,裡面的邏輯和內容都已注釋,可通過注釋了解這一方法的運作模式。public static void rowtouzi int playerpos 擲色子 按任意鍵開始擲色子 playernames playerpos 不顯示用ucvnajjk戶按下的任意鍵 co...

C 編寫飛行棋遊戲

using system using system.collections.generic using system.linq using system.text using system.threading.tasks using system.drawing 繪圖 namespace plane...