其中思路很简单,单线程的一个乱七八糟的游戏

预计会更新背包,背包这个估计会用一个vector来存

图形的话,我得催催我的美工大人,她会帮我弄吧,哇哈哈

界面:

 namespace auttompk
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows 窗体设计器生成的代码 /// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.explabel = new System.Windows.Forms.Label();
this.attacklabel = new System.Windows.Forms.Label();
this.hplabel = new System.Windows.Forms.Label();
this.levellabel = new System.Windows.Forms.Label();
this.fightbox = new System.Windows.Forms.TextBox();
this.splitter1 = new System.Windows.Forms.Splitter();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(, );
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(, );
this.button1.TabIndex = ;
this.button1.Text = "开始";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(, );
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(, );
this.button2.TabIndex = ;
this.button2.Text = "停止";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(, );
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(, );
this.label1.TabIndex = ;
this.label1.Text = "生命值";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(, );
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(, );
this.label2.TabIndex = ;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(, );
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(, );
this.label3.TabIndex = ;
this.label3.Text = "攻击力";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(, );
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(, );
this.label6.TabIndex = ;
this.label6.Text = "等级";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(, );
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(, );
this.label4.TabIndex = ;
this.label4.Text = "经验值";
//
// explabel
//
this.explabel.AutoSize = true;
this.explabel.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
this.explabel.Location = new System.Drawing.Point(, );
this.explabel.Name = "explabel";
this.explabel.Size = new System.Drawing.Size(, );
this.explabel.TabIndex = ;
this.explabel.Text = "label5";
//
// attacklabel
//
this.attacklabel.AutoSize = true;
this.attacklabel.Location = new System.Drawing.Point(, );
this.attacklabel.Name = "attacklabel";
this.attacklabel.Size = new System.Drawing.Size(, );
this.attacklabel.TabIndex = ;
this.attacklabel.Text = "label7";
//
// hplabel
//
this.hplabel.AutoSize = true;
this.hplabel.Location = new System.Drawing.Point(, );
this.hplabel.Name = "hplabel";
this.hplabel.Size = new System.Drawing.Size(, );
this.hplabel.TabIndex = ;
this.hplabel.Text = "label8";
//
// levellabel
//
this.levellabel.AutoSize = true;
this.levellabel.Location = new System.Drawing.Point(, );
this.levellabel.Name = "levellabel";
this.levellabel.Size = new System.Drawing.Size(, );
this.levellabel.TabIndex = ;
this.levellabel.Text = "label9";
//
// fightbox
//
this.fightbox.Location = new System.Drawing.Point(, );
this.fightbox.Multiline = true;
this.fightbox.Name = "fightbox";
this.fightbox.Size = new System.Drawing.Size(, );
this.fightbox.TabIndex = ;
//
// splitter1
//
this.splitter1.Location = new System.Drawing.Point(, );
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(, );
this.splitter1.TabIndex = ;
this.splitter1.TabStop = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(, );
this.Controls.Add(this.splitter1);
this.Controls.Add(this.fightbox);
this.Controls.Add(this.levellabel);
this.Controls.Add(this.hplabel);
this.Controls.Add(this.attacklabel);
this.Controls.Add(this.explabel);
this.Controls.Add(this.label4);
this.Controls.Add(this.label6);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "挂机传奇";
this.ResumeLayout(false);
this.PerformLayout(); } #endregion private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label explabel;
private System.Windows.Forms.Label attacklabel;
private System.Windows.Forms.Label hplabel;
private System.Windows.Forms.Label levellabel;
private System.Windows.Forms.TextBox fightbox;
private System.Windows.Forms.Splitter splitter1;
}
}

新的类:

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace auttompk
{
class monster
{
public string name;
public int hp;
public int attack;
public int money;
public int exp;
public int max_hp;
}
}

具体代码:

 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 auttompk
{
public partial class Form1 : Form
{
monster shilaimu=new monster(); int level = ;
int max_hp = ;
int now_hp = ;
int attack = ;
int now_exp = ;
int ful_exp = ;
int flag = ; private void start()
{
shilaimu.name="史莱姆";
shilaimu.hp=;
shilaimu.attack=;
shilaimu.money=;
shilaimu.exp=;
shilaimu.max_hp = ;
}
public Form1()
{ InitializeComponent();
start();
show();
} private void show()
{
levellabel.Text = (level).ToString();
hplabel.Text = now_hp.ToString() + "/" + max_hp.ToString();
attacklabel.Text = (attack).ToString();
explabel.Text = now_exp.ToString() + "/" + max_hp.ToString();
} private void find()
{
fightbox.Text += "你遇见了"+shilaimu.name.ToString()+"\r\n";
pk(shilaimu);
} private void pk(monster a)
{
while (true)
{
if (flag == )
{
break;
}
timeDelay();
fightbox.Text += "你对" + a.name.ToString() + "造成了" + attack.ToString() + "伤害\r\n";
a.hp-=attack;
if (a.hp <= )
{
fightbox.Text += "你干死了" + a.name.ToString() + "\r\n";
fightbox.Text += "获得了" + a.money.ToString() + "块钱\r\n";
fightbox.Text += "获得了" + a.exp.ToString() + "经验\r\n\r\n\r\n\r\n";
now_exp += a.exp;
if (now_exp >= ful_exp)
{
now_exp -= ful_exp;
ful_exp *= ;
level += ;
attack *= ;
}
a.hp = a.max_hp;
show();
break;
}
timeDelay();
fightbox.Text += a.name.ToString() + "还剩下" + a.hp.ToString()+"HP\r\n";
if (flag == )
{
break;
}
timeDelay();
if (flag == )
{
break;
}
fightbox.Text += a.name.ToString() + "对你造成了" + attack.ToString() + "伤害\r\n"; now_hp -= a.attack;
if (now_hp <= )
{
fightbox.Text += "你挂了\r\n";
fightbox.Text += "你损失了一半经验值\r\n\r\n\r\n\r\n";
now_exp /= ;
now_hp = max_hp;
a.hp = a.max_hp;
show();
break;
} show();
timeDelay();
}
} private void button1_Click(object sender, EventArgs e)
{ fightbox.Text += "开始挂机\r\n\r\n\r\n\r\n";
flag=;
while (flag == )
{
find();
}
}
private void timeDelay(double secend)
{
DateTime tempTime = DateTime.Now;
while(tempTime.AddSeconds(secend).CompareTo(DateTime.Now) > )
Application.DoEvents(); } private void button2_Click(object sender, EventArgs e)
{
fightbox.Text += "停止挂机\r\n\r\n";
flag = ;
}
}
}

最新文章

  1. Ubuntu学习总结-10 XManager
  2. Android JNI HelloWorld实现
  3. N个元素的集合划分成互斥的两个子集的数目
  4. 给WebApp加一个“壳”,实现Andriod系统添加到桌面
  5. java中传值及引伸深度克隆的思考(说白了Java只能传递对象指针)
  6. 全方位分析Objcetive-C Runtime
  7. lua 二维数组创建
  8. Android 使用Glide加载网络图片等比例缩放
  9. 060 SparkStream 的wordcount示例
  10. sublime text3最常用快捷键
  11. 缓存击穿、缓存失效及热点key的解决方案
  12. rtrim() 函数 从字符串的末端开始删除空白字符!
  13. 2017-2018-2 java红茶第二周作业
  14. php基础-2
  15. ASP入门(十八)-访问Access中的数据库
  16. ajax请求格式
  17. java 高性能读模式(译)
  18. [YC703]ゴミ拾い Easy
  19. Tag It 一款 Jquery控件,当你在文本框中输入逗号时,自动帮你分隔开相关内容
  20. 1406: [AHOI2007]密码箱

热门文章

  1. HDU 6215 2017Brute Force Sorting 青岛网络赛 队列加链表模拟
  2. Android studio 安装过程中遇到的问题
  3. Luogu P1160 【队列安排】
  4. WinForm界面开发之 启动界面
  5. 【LOJ】#2291. 「THUSC 2016」补退选
  6. PCA(Principal Component Analysis)主成分分析
  7. Loadrunner参数化逗号报错解决方法
  8. JSP的学习三(中文乱码)
  9. git获取帮助
  10. C#导出HTML到PDF组件Pechkin