package com.stj.views;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
/*
 * 潜艇被击中的爆炸效果,通过图片显示
 */
public class Hit implements Runnable 
{
	private MyPanel panel;  //主面板
	private Image   image;  //图片
	private int     liveTime =  500; //爆炸效果显示的时间默认为500毫秒
	private int     beginX   =  0; //位置 x y
	private int     beginY   =  0;
	private boolean isRunning    =  false; //游戏是否正在运行标志
	
	public Hit(int x,int y,MyPanel panel)
	{
		this.beginX = x;
		this.beginY = y;
		this.panel  = panel;
		this.image  = Toolkit.getDefaultToolkit().getImage("imgs/炸弹效果.png");
		this.image  = new ImageIcon(this.image).getImage();
	}
	
	public void drawHitting(Graphics2D g)
	{
		g.drawImage(this.image, this.beginX,this.beginY,this.panel);
	}
	
	public void run()
	{
		while(!this.isRunning)
		{
			try {
				Thread.sleep(this.liveTime);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			this.isRunning = true;
		}
		
	}
	public boolean isRunning() {
		return isRunning;
	}
	public void setRunning(boolean isRunning) {
		this.isRunning = isRunning;
	}
	
}
最近下载更多
                
                2890892945     LV2
                2023年12月26日
            
            
        
                huangzy     LV12
                2023年4月6日
            
            
        
                1839855274     LV1
                2021年12月21日
            
            
        
                wjl0529     LV3
                2021年12月21日
            
            
        
                咕噜咕噜啦la     LV9
                2021年12月18日
            
            
        
                选了了     LV7
                2021年12月15日
            
            
        
                MyList     LV1
                2021年12月10日
            
            
        
                tangjj7260     LV18
                2021年10月26日
            
            
        
                焦油怪     LV1
                2021年9月30日
            
            
        
                小白小怪     LV10
                2021年6月19日
            
            
        
最近浏览更多
                
                2890892945     LV2
                2023年12月26日
            
            
        
                yellee    
                2023年10月23日
            
            
                    暂无贡献等级
            
        
                yerwiu     LV10
                2023年7月30日
            
            
        
                y1214435276     LV9
                2023年7月11日
            
            
        
                17683946472     LV9
                2023年6月8日
            
            
        
                huangzy     LV12
                2023年4月6日
            
            
        
                bin2337     LV4
                2023年3月30日
            
            
        
                小学虎QAQ    
                2022年12月9日
            
            
                    暂无贡献等级
            
        
                13373265420     LV1
                2022年12月8日
            
            
        
                取名字好麻烦     LV5
                2022年10月30日
            
            
        
                
                
                