2025年WPF飞行棋(分析+案例)

WPF飞行棋(分析+案例)一 飞行棋分析 游戏规则 1 两个人轮流掷骰子红人和绿人 2 投掷出 2 4 6 点出门 投掷出 6 点可以在出门后再次投掷行走 3 地图长度共 100 步 4 地图中除过普通地板之外 另设六种特殊功能地板 1 踩到香蕉皮 退 6 步 2 踩到时空 前进 6 步 3 踩到陷阱 暂停一回合 4 踩到星星 可以再投掷一次 5 踩到移魂大法 可以做出选择与对方互换位置 6 踩到手枪

大家好,我是讯享网,很高兴认识大家。

一. 飞行棋分析:

  • 游戏规则:
    1. 两个人轮流掷骰子红人和绿人
    2. 投掷出2,4,6点出门,投掷出6点可以在出门后再次投掷行走
    3. 地图长度共100步
    4. 地图中除过普通地板之外,另设六种特殊功能地板
    1. 踩到香蕉皮,退6步
    2. 踩到时空,前进6步
    3. 踩到陷阱,暂停一回合
    4. 踩到星星,可以再投掷一次
    5. 踩到移魂大法,可以做出选择与对方互换位置
    6. 踩到手枪,可以击退对方3步
    7. 踩到大炮,可以直接将对方轰炸回家(需要重新出门)
    5. 如果踩到对方,则对方直接回到起点, 游戏策划
  1. 地图面积30*13
  2. 每个格子30像素
  3. 地面的代号=0,普通地板=1,香蕉皮=2,时空=3,陷阱=4,星星=5,大挪移=6,手枪=7
    红人=8,绿人=9

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace 飞行棋3
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    //游戏界面
    Panel map = new Panel();


    讯享网

    //红盒子
    PictureBox redPlayer = new PictureBox();
    //绿盒子
    PictureBox greenPlayer = new PictureBox();
    private void Form1_Load(object sender, EventArgs e)
    {
    //固定窗口位置
    this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
    this.BackColor = Color.FloralWhite;
    this.Width = 1200;
    this.Height = 600;
    this.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - this.Width / 2;
    this.Top = Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2;

     //游戏界面 //Panel map = new Panel(); /*map.Width = mapList.GetLength(0) *size; map.Height = mapList.GetLength(1) * size;*/ //图片和格子数相乘等于整个地图的宽高(也可以给具体的数字) map.Width = 30 * size; map.Height = 13 * size; map.Location = new Point(20, 150); map.BorderStyle = BorderStyle.FixedSingle; this.Controls.Add(map); //调用这个盒子,使创建的地板以数组图片的形式显示在map地图中(在调用里面创建图片已经添加到map) InitialGame(); //框架加载时调用路的数组位置,并全部创建好数的位置 //CreateRoed(); //数组记录的地图划分 mapList, mapList中的路用1代替 //CreateMap(); // Panel redplayHome = new Panel(); redplayHome.Size = new Size(100, 100); redplayHome.BackgroundImage = Image.FromFile("../../img/select_circle.png"); redplayHome.Location = new Point(50, map.Top - 120); redplayHome.BackgroundImageLayout = ImageLayout.Stretch; this.Controls.Add(redplayHome); //Panel greenplayHome = new Panel(); greenplayHome.Size = new Size(100, 100); greenplayHome.BackgroundImage = Image.FromFile("../../img/select_circle.png"); greenplayHome.Location = new Point(170, map.Top - 120); greenplayHome.BackgroundImageLayout = ImageLayout.Stretch; this.Controls.Add(greenplayHome); //PictureBox redPlayer = new PictureBox(); redPlayer.Size = new Size(80, 80); redPlayer.Image = Image.FromFile("../../img/red.png"); redPlayer.Location = new Point(10, 10); redPlayer.SizeMode = PictureBoxSizeMode.StretchImage; redplayHome.Controls.Add(redPlayer); //PictureBox greenPlayer = new PictureBox(); greenPlayer.Size = new Size(80, 80); greenPlayer.Image = Image.FromFile("../../img/green.png"); greenPlayer.Location = new Point(10, 10); greenPlayer.SizeMode = PictureBoxSizeMode.StretchImage; greenplayHome.Controls.Add(greenPlayer); //红方和绿方 Label h = new Label(); h.Text = "红方"; h.AutoSize = true; //h. h.Location = new Point(redPlayer.Width / 2 - 11, redPlayer.Height / 2 - h.Height / 2); redPlayer.Controls.Add(h); Label L = new Label(); L.Text = "绿方"; L.AutoSize = true; // L. L.Location = new Point(greenPlayer.Width / 2 - 11, greenPlayer.Height / 2 - L.Height / 2); greenPlayer.Controls.Add(L); msg.Size = new Size(260, 600); msg.Location = new Point(map.Right + 20, 50); msg.ReadOnly = true; this.Controls.Add(msg); dice.Size = new Size(100, 100); dice.Image = Image.FromFile("../../img/roll.png"); dice.Location = new Point(msg.Left - 150, 50); dice.SizeMode = PictureBoxSizeMode.StretchImage; this.Controls.Add(dice); dice.MouseClick += Dice_MouseClick; string startmsg = "请两个人先轮流掷骰子,点大的先行一步,红方先手"; ResultTell(startmsg); 

    讯享网

    }
    Random sj = new Random();
    /* private void Dice_MouseClick(object sender, MouseEventArgs e)
    {
    int j = sj.Next(1, 7);
    int i = sj.Next(1, 7);
    if (i > j)
    {
    ResultTell(“红方先投掷出” + i + “点” + “,则” + i + “>” + j + “红方先出”);
    }
    else if (j < i)
    {
    ResultTell(“绿方先投掷出” + i + “点” + “,则” + i + “<” + j + “绿方先出”);
    }
    else if (j == i)
    {
    ResultTell(i + “=” + i + “两个i一样从新投掷出”);
    }
    }*/
    void ResultTell(string str)
    {
    MessageBox.Show(str);
    msg.AppendText(str + “\r\n”);//把比较的文字添加到msg里面
    }

    //一、
    //@@@_看情况制筛子(下面是制筛子的所有代码):
    //1、表示双方制出筛子的点数
    int[

小讯
上一篇 2025-03-01 20:25
下一篇 2025-01-07 11:04

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/28943.html