package bomberman;
import java.awt.*;
import javax.swing.*;
public class Bombs implements Runnable
{
private Image img;
private Image expimg;
private int posx,posy;
private BomberMap map;
public boolean canexplode=false;
private Thread thrd;
private static boolean a=true;
long tick_start_time=0;
long tick_end_time;
long tick_duration;public Bombs(int x,int y,BomberMap map)
{
thrd=new Thread(this);
posx=x;
posy=y;
this.map=map;
String str = "E:/jdk1.4/bin/bomberman/Images/BomberBombs/1.gif";
img = new ImageIcon(str).getImage();
str = "E:/jdk1.4/bin/bomberman/Images/BomberFires/C2.gif";
expimg = new ImageIcon(str).getImage();}
public void run()
{
while(true)
{
tick_end_time = System.currentTimeMillis();
tick_duration = tick_end_time - tick_start_time;
if(tick_duration>=3000)
{
canexplode=true;
break;
}
try
{
Thread.sleep(50);
}
catch(Exception e){}
}
}
public Image getImage()
{
return img;
}
public void puton(int x,int y)
{
posx=x;
posy=y;
canexplode=false;
tick_start_time=System.currentTimeMillis();
thrd=new Thread(this);
thrd.start();
}
public int getX()
{
return posx;
}
public int getY()
{
return posy;
}
public void draw(Graphics2D g2)
{
if(a==true)
{
String str = "E:/jdk1.4/bin/bomberman/Images/BomberBombs/2.gif";
img = new ImageIcon(str).getImage();
a=false;
}
else
{
String str = "E:/jdk1.4/bin/bomberman/Images/BomberBombs/1.gif";
img = new ImageIcon(str).getImage();
a=true;
}
g2.drawImage(img,posx*17,posy*17,null);
}
}