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

📄 explode.java

📁 坦克大战源代码,坦克大战源代码,坦克大战源代码
💻 JAVA
字号:
package org.MyTank;
import java.awt.Color;
import java.awt.Graphics;

public class Explode {
    private int x, y;
    private boolean live = true;

    private int[] shape = { 4, 9, 15, 24, 30, 20, 4 };
    private int step = 0;

    TankWarGUI tw;

    public Explode(int x, int y, TankWarGUI tw) {
	this.x = x;
	this.y = y;
	this.tw = tw;
    }

    public void draw(Graphics g) {
	if (!live) {
	    tw.explodes.remove(this);
	    return;
	}

	if (step == shape.length) {
	    live = false;
	    step = 0;
	    return;
	}

	Color c = g.getColor();
	g.setColor(Color.orange);
	g.fillOval(x, y, shape[step], shape[step]);
	g.setColor(c);
	step++;
    }
}

⌨️ 快捷键说明

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