explode.java

来自「java 写的坦克大战,,里面涉及了java几乎所有的基础知识..」· Java 代码 · 共 34 行

JAVA
34
字号
package com.wuxiaohong.tank;
import java.awt.*;

public class Explode {
	private int x,y;
	private boolean live=true;
	int diameter[] ={4,7,15,27,33,16,5,4,1};
	TankClient tc;
	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(step==diameter.length)
		{
			this.live=false;
			tc.explode.remove(this);
			return;
		}
		Color c = g.getColor();
		g.setColor(Color.ORANGE);
		g.fillOval(x, y, diameter[step], diameter[step]);
		g.setColor(c);	
		step++;
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?