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

📄 explode.java

📁 纯java编写的坦克大战游戏.把项目引入eclipse后立即可运行。在此基础上可进行二次开发哦。
💻 JAVA
字号:
import java.awt.Color;
import java.awt.Graphics;


public class Explode {
	int x, y;
	boolean live = true;
	private int[] diameters = {3, 7, 12, 20, 29, 40, 53, 67, 42, 18, 5};
	private int step = 0;
	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;
		}
		
		Color c = g.getColor();
		g.setColor(Color.ORANGE);
		g.fillOval(x, y, diameters[step], diameters[step]);
		g.setColor(c);
		
		step ++;
		
		if(step == diameters.length) {
			live = false;
		}
		
	}
}

⌨️ 快捷键说明

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