编辑:删除了其他帖子,因为它出现在错误的论坛上。
Form1中:
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 Fight_Game
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void ChooseEasy_Click(object sender, EventArgs e)
{
Combat_Form cf = new Combat_Form(5,8,19/*Need to send a lot of shit through here like monster health, and image to use.*/);
cf.ShowDialog();
}
}
表格2
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;
using Fight_Game;
namespace Fight_Game
{
public partial class Combat_Form : Form
{
static int i, j, k;
public Combat_Form(int x, int y, int z)
{
InitializeComponent();
i = x;
j = y;
k = z;
}
Class1 test = new Class1(i, j);
private void button1_Click(object sender, EventArgs e)
{
EnemyLifeBar.Increment(i);
PlayerLifeText.Text = "Life: " + test.Life.ToString() + "/100";
PlayerLifeBar.Increment(test.Life);
}
}
}
第1课:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Fight_Game
{
class Class1
{
public int Life;
public int Mana;
public Class1(int x, int y)
{
Life = x;
Mana = y;
}
}