Wind



import java.awt.*;
import java.util.*;


class Wind
{
	private int xco,yco;
	private int width, height;
	private boolean alive;
	private int maxX,maxY;
	private int depth;
	private int sign = 1;
	private int speed =1;
	private int strength;

	public Wind(int x,int y)
	{
		maxY = y;
		maxX = x;
		xco = 100;
		yco=100;
		width = 50;
		height = 50;
		depth = 1;
	}

	public boolean isAlive()
	{
		return alive;
	}

	public int getXco()
	{
		return xco;
	}

	public int getYco()
	{
		return yco;
	}

	public int getWidth()
	{
		return width;
	}

	public int getHeight()
	{
		return height;
	}

	public int getDepth()
	{
		return depth;
	}

	public void newWind()
	{
		xco = (int)(Math.random()*maxX-50);
		yco = (int)(Math.random()*maxY-50);
		depth = (int)(Math.random()*3);
		speed = (int)(Math.random()*3)+1;
		sign = sign*(-1);
		strength = (int)(Math.random()*3)+1;
		width = 100;
		height = 50;
		alive = true;
	}

	public void move()
	{
		if (getXco()+getWidth() < 0 || getXco() > maxX) alive = false;
		xco = getXco()+(speed)*sign;

	}

	public int getSign()
	{
		return sign;
	}

	public int getStrength()
	{
		return strength;
	}

}

Return to index

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.