explode.java
来自「java小项目,坦克大战,学习的好资料 eclipse下可运行」· Java 代码 · 共 32 行
JAVA
32 行
import java.awt.*;
public class Explode {
int x, y;
private boolean live = true;
private TankClient tc;
int[] diameter = {4,8,12,16,20,15,10,7};
int step = 0;
public Explode(int x, int y, TankClient tc) {
this.x = x;
this.y = y;
this.tc = tc;
}
public void draw(Graphics g) {
if(!live) return;
if(step == diameter.length) {
live = false;
step = 0;
}
Color c = g.getColor();
g.setColor(Color.red);
g.fillOval(x, y, diameter[step], diameter[step]);
g.setColor(c);
step ++;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?