import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;

public class BombTank {
	private int x, y;
	private boolean live = true; // 初始状态为活着的
	private TankClient tc;
	private static Toolkit tk = Toolkit.getDefaultToolkit();

	private static Image[] imgs = { // 存储爆炸图片 从小到大的爆炸效果图
			tk.getImage(BombTank.class.getClassLoader().getResource(
					"images/1.gif")),
			tk.getImage(BombTank.class.getClassLoader().getResource(
					"images/2.gif")),
			tk.getImage(BombTank.class.getClassLoader().getResource(
					"images/3.gif")),
			tk.getImage(BombTank.class.getClassLoader().getResource(
					"images/4.gif")),
			tk.getImage(BombTank.class.getClassLoader().getResource(
					"images/5.gif")),
			tk.getImage(BombTank.class.getClassLoader().getResource(
					"images/6.gif")),
			tk.getImage(BombTank.class.getClassLoader().getResource(
					"images/7.gif")),
			tk.getImage(BombTank.class.getClassLoader().getResource(
					"images/8.gif")),
			tk.getImage(BombTank.class.getClassLoader().getResource(
					"images/9.gif")),
			tk.getImage(BombTank.class.getClassLoader().getResource(
					"images/10.gif")), };
	int step = 0;

	public BombTank(int x, int y, TankClient tc) { // 构造函数
		this.x = x;
		this.y = y;
		this.tc = tc;
	}

	public void draw(Graphics g) { // 画出爆炸图像

		if (!live) { // 坦克消失后删除爆炸图
			tc.bombTanks.remove(this);
			return;
		}
		if (step == imgs.length) {
			live = false;
			step = 0;
			return;
		}

		g.drawImage(imgs[step], x, y, null);
		step++;
	}
}
最近下载更多
bigcat12  LV5 2024年4月30日
krispeng  LV15 2024年4月16日
lwl1207  LV4 2023年8月29日
aa12356  LV1 2023年3月26日
hkxyyz  LV6 2023年3月2日
3043864991  LV2 2023年1月5日
jameshkj  LV8 2023年1月1日
冰锋之泪  LV7 2023年1月1日
337110415  LV7 2022年10月24日
2483935277  LV3 2022年9月3日
最近浏览更多
开膛手杰克哈哈哈  LV1 6月22日
147147 6月4日
暂无贡献等级
kkdulx  LV1 1月7日
aaaatw 1月3日
暂无贡献等级
鲁一宇  LV5 2024年12月24日
wyy1234 2024年7月16日
暂无贡献等级
bigcat12  LV5 2024年4月30日
krispeng  LV15 2024年4月16日
1511602303 2024年1月5日
暂无贡献等级
12345685  LV2 2024年1月2日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友