📄 map.java
字号:
import java.awt.*;
public class map{
public enemy[] Enemy;
public map(enemy[] Enemy){
this.Enemy = Enemy;
}
public void update(enemy[] Enemy){
this.Enemy = Enemy;
}
public void draw(Graphics g){
g.setColor(Color.orange);
g.drawRect(1,1, 150,150);
g.drawRect(2,2, 148,148);
for(int i = 0; i < Enemy.length; i++){
if(Enemy[i] != null){
if(Enemy[i].distanceFromTarget() == 0){
g.setColor(Color.blue);
vector direction = new vector(Enemy[i].getDirection3D().a, -Enemy[i].getDirection3D().b);
vector left = direction.rotate2D(-Math.PI/6).unit();
vector right = direction.rotate2D(Math.PI/6).unit();
vector p1 = direction.unit().scale(4).add(new vector(75,75));
vector p2 = direction.unit().scale(-4).add(new vector(75,75));
g.drawLine((int)p1.a, (int)p1.b, (int)p2.a, (int)p2.b);
vector p3 = p1.add(left.scale(-3));
vector p4 = p1.add(right.scale(-3));
g.drawLine((int)p1.a, (int)p1.b, (int)p4.a, (int)p4.b);
g.drawLine((int)p1.a, (int)p1.b, (int)p3.a, (int)p3.b);
}
else{
g.setColor(Color.red);
vector p = Enemy[i].miniMapPosition().add(new vector(75,75));
if(!(p.a >= 148 || p.a <=2 || p.b >= 148 || p.b <=2))
g.fillRect((int)(p.a - 1), (int)(p.b - 1), 3, 3);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -