⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 explode.java

📁 J2SE坦克大战源码 分为24个版本
💻 JAVA
字号:
import java.awt.Color;
import java.awt.Graphics;






public class Explode {
	int x;
	int y;
	int[] diameter = {4,10,14,18,20,25,32,28,25,30,45,50,41,30,15,14,12,3,1};
	int step = 0;
	private boolean live = true;
	private TankClient tc;
	
	public Explode(int x, int y, TankClient tc) {
		this.x = x;
		this.y = y;
		this.tc = tc;
	} 
	
	public void draw(Graphics g){
		if(!live){
			tc.explodes.remove(this);
			return;		
		}
		if(step == diameter.length){
			live = false;
			return;			
		}
		
		Color c = g.getColor();
		g.setColor(Color.ORANGE);
		g.fillOval(x, y, diameter[step],diameter[step]);
		g.setColor(c);
		
		step ++;
	}

	public boolean isLive() {
		return live;
	}

	public void setLive(boolean live) {
		this.live = live;
	}




	
}

⌨️ 快捷键说明

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