explod.java
来自「坦克大战,最基本的Graphics 类进行的画图。TankClient.java」· Java 代码 · 共 36 行
JAVA
36 行
package tank;
import java.awt.Graphics;
import java .awt.Color;
public class Explod {
private boolean live;
private int x,y;
private int step=0;
private TankClient tc;
int[] width=new int []{10,15,25,40,10,5};
public Explod(int x,int y,TankClient tc){
this.x=x;
this.y=y;
this.live=true;
this.tc=tc;
}
public void draw(Graphics g){
if(!live){
return;
}
if(step==width.length){
step=0;
live=false;
tc.explodList.remove(this);
}
Color c=g.getColor();
g.setColor(Color.ORANGE);
if(step<width.length){
g.fillOval(x, y, width[step], width[step]);
step++;
}
g.setColor(c);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?