src/Missile.java
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
import java.awt.*;
import java.util.List;
public class Missile {
int x, y;
Tank.Direction dir;
public static final int XSPEED = 10, YSPEED = 10;
public static final int WIDTH = 10, HEIGHT = 10;
private boolean good;
private boolean live = true;
private int code;
public boolean hitTanks(List<Tank> tanks) {
for (int i = 0; i < tanks.size(); i++) {
if (hitTank(tanks.get(i))) {
return true;
}
}
return false;
}
public void setLive(boolean live) {
this.live = live;
}
private TankClient tc;
public boolean isLive() {
return live;
}
public Missile(int x, int y, Tank.Direction dir) {
this.x = x;
this.y = y;
this.dir = dir;
}
public Missile(int x, int y, boolean good, Tank.Direction dir,
TankClient tc, int code) {
this.x = x;
this.y = y;
this.dir = dir;
this.tc = tc;
this.good = good;
this.code = code;
}
public Rectangle getRect() {
return new Rectangle(x, y, WIDTH, HEIGHT);
}
public boolean hitTank(Tank t) {
if (this.getRect().intersects(t.getRect()) && t.isLive()
&& this.good != t.isGood()) {
if (t.isGood()) {
t.setLife(t.getLife() - 20);
if (t.getLife() <= 0) {
t.setLive(false);
}
后面还有 85 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。