Vectors | Fireworks | Particle Systems | Fading | Snow | Fire | Applet1 Code
// Código para 'Applet1':
import java.awt.Graphics;
public class Applet1 extends java.applet.Applet implements Runnable
{
Thread thd;
int sleep = 50;
public void init()
{
}
public void start()
{
if(thd==null)
{
Thread thd=new Thread(this);
thd.start();
}
}
public void stop()
{
if(thd!=null)
{
thd.stop();
thd=null;
}
}
public void run()
{
while(true)
{
game();
repaint();
try
{
Thread.sleep(sleep);
}
catch(InterruptedException e){}
}
}
public void update(Graphics g)
{
paint(g);
}
public void setSleepTime(int sleepTime)
{
sleep = sleepTime;
}
public void appletRun()
{
}
public int rnd(int Value)
{
return (int)(Math.random() * Value);
}
public float rnd(float Value)
{
return (float)(Math.random() * Value);
}
}