Play.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace Tank_11_14
{
public abstract class Play:Roles
{
private Image[] img = new Image[] { };
//构造方法(类和方法相对应)
//判断是否移动
protected bool isMove = false;//默认不动的
private int live = 2;
public int Live
{
get { return live; }
set { live = value; }
}
//子弹等级
private int misLv = 0;
public int MisLv
{
get { return misLv; }
set { misLv = value; }
}
//定义布尔型变量,判断上下左右键是否被按下,开始默认都没按下
protected bool dirU = false, dirD = false, dirL = false, dirR = false;
public Play(int x, int y, int life, int speed, direction dr,Image[] img)
: base(x, y, life, img[0].Width, img[0].Height, speed, dr)
{
//传入的图片保存
this.img = img;
Beborn(); //构造调用出生的方法
}
//重写Adjustdirection方法
public override void Adjustdirection()
{
if (dirU && !dirD && !dirL && !dirR)
{
dr = direction.U;
}
else if (!dirU && dirD && !dirL && !dirR)
{
dr = direction.D;
}
else if (!dirU && !dirD && dirL && !dirR)
{
dr = direction.L;
}
else if (!dirU && !dirD && !dirL && dirR)
{
dr = direction.R;
}
}
后面还有 85 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。