//角色位置坐标
public struct Position2D{
public int X;
public int Y;
}
class Batering {
public int ATK;
public int SP;
public int DF;
public int Ld;
public int HP;
public int FV;
public int DT;
public Position2D position;
//设置英雄信息
public void Setinfor(int atk,int sp,int df,int ld,int hp,int fv,int dt){
ATK = atk;
SP = sp;
DF = df;
Ld = ld;
HP = hp;
FV = fv;
DT = dt;
position.X = 0;
position.Y = 0;
Console.WriteLine ("攻击力{0} 速度{1} 防御{2} 负重{3} 血量{4} 战斗力{5} 掉血量{6}",ATK,SP,DF,Ld,HP,FV,DT);
}
//英雄攻击
public void Attack(Batering player){
player.HP -= (ATK - player.DF);
Console.WriteLine ("你正在攻击,敌人血量{0}",player.HP);
}
//英雄受伤
public void Hurt(Batering player){
HP -= player.ATK - DF;
Console.WriteLine ("你受到攻击,角色剩余血量{0}",HP);
}
//wasd控制前后左右行走
public void Move(){
Console.WriteLine ("请输入一个方向");
int a = Console.Write();
switch ((char)a) {
case 'w':
{
position.Y++;
break;
}
case 's':
{
position.Y++;
break;
}
case 'a':
{
position.X++;
break;
}
case 'd':
{
position.X++;
break;
}
default:
Console.WriteLine ("输入错误");
break;
public struct Position2D{
public int X;
public int Y;
}
class Batering {
public int ATK;
public int SP;
public int DF;
public int Ld;
public int HP;
public int FV;
public int DT;
public Position2D position;
//设置英雄信息
public void Setinfor(int atk,int sp,int df,int ld,int hp,int fv,int dt){
ATK = atk;
SP = sp;
DF = df;
Ld = ld;
HP = hp;
FV = fv;
DT = dt;
position.X = 0;
position.Y = 0;
Console.WriteLine ("攻击力{0} 速度{1} 防御{2} 负重{3} 血量{4} 战斗力{5} 掉血量{6}",ATK,SP,DF,Ld,HP,FV,DT);
}
//英雄攻击
public void Attack(Batering player){
player.HP -= (ATK - player.DF);
Console.WriteLine ("你正在攻击,敌人血量{0}",player.HP);
}
//英雄受伤
public void Hurt(Batering player){
HP -= player.ATK - DF;
Console.WriteLine ("你受到攻击,角色剩余血量{0}",HP);
}
//wasd控制前后左右行走
public void Move(){
Console.WriteLine ("请输入一个方向");
int a = Console.Write();
switch ((char)a) {
case 'w':
{
position.Y++;
break;
}
case 's':
{
position.Y++;
break;
}
case 'a':
{
position.X++;
break;
}
case 'd':
{
position.X++;
break;
}
default:
Console.WriteLine ("输入错误");
break;
}
}
}
}