|
| //* 1996 Growler Software, Inc. *//
import java.awt.*;
import java.applet.*;
import java.lang.*;
import java.util.*;
import java.net.*;
public class Firework extends Applet implements Runnable
{
public int AnimationSpeed,
RocketStyleVariability,
MaxRocketNumber,
MaxRocketExplosionEnergy,
MaxRocketPatchNumber,
MaxRocketPatchLength,
Gravity;
public String RocketSoundtrack;
private int mx,my;
private Thread thread=null;
private Rocket rocket[];
public void init()
{
int i;
String p;
p=getParameter("AnimationSpeed");
AnimationSpeed=(p==null)?100:Integer.valueOf(p).intValue();
RocketSoundtrack=getParameter("RocketSoundtrack");
p=getParameter("RocketStyleVariability");
RocketStyleVariability=(p==null)?20:Integer.valueOf(p).intValue();
p=getParameter("MaxRocketNumber");
MaxRocketNumber=(p==null)?5:Integer.valueOf(p).intValue();
p=getParameter("MaxRocketExplosionEnergy");
MaxRocketExplosionEnergy=(p==null)?500:Integer.valueOf(p).intValue();
p=getParameter("MaxRocketPatchNumber");
MaxRocketPatchNumber=(p==null)?50:Integer.valueOf(p).intValue();
p=getParameter("MaxRocketPatchLength");
MaxRocketPatchLength=(p==null)?100:Integer.valueOf(p).intValue();
p=getParameter("Gravity");
Gravity=(p==null)?20:Integer.valueOf(p).intValue();
mx=size().width-1;
my=size().height-1;
rocket=new Rocket[MaxRocketNumber];
for(i=0;i=0&&c<256)red=c;
c=(int)(random.nextDouble()*64)-32+blue;
if(c>=0&&c<256)blue=c;
c=(int)(random.nextDouble()*64)-32+green;
if(c>=0&&c<256)green=c;
color=new Color(red,blue,green);
for(i=0;i=length/2)
{
int j;
for(j=0;j<2;j++)
{
s=(double)((t-length/2)*2+j)/100;
x=(int)(vx[i]*s);
y=(int)(vy[i]*s-gravity*s*s);
g.setColor(Color.black);
g.drawLine(ox+x,oy-y,ox+x,oy-y);
}
}
}
t++;
}
else
{
sleep=true;
}
}
}
|
| |