NetDragons The Matrix Posters | Nirvana Posters
Games | Free Web Hosting | DVD | Books | Shop | Posters
Google
Name
Password
Save Password?



[-]NetDragons.com
[-]Games
 | [-]24 Hour Games
 |  | [-]Nelzan
 |  |  | [+]Capital Ships
 |  |  | [+]Light Fighters
 |  |  | [+]Medium Fighters
 |  |  | [+]Play It Now!
 |  |  | [+]Player
 |  |  | [+]Forum
 |  |  | [-]Source Code
 |  | [+]Space Frag I
 |  | [+]GNet Server
 |  | [+]About
 |  | [+]Forum
 |  | [+]License
 | [+]Cards of Tridala
 | [+]Flash Games
 | [+]Vagabond's Quest+
 | [+]Vagabond's Quest v.2
 | [+]Projects
[+]NetDragons.com Live!
[+]Reward Center
[+]Software Center
[+]Company Information
[+]Personal Services
[+]Member Directory
[+]Free E-mail
[+]Buy Cool Stuff
[+]Posters
[+]Your Privacy

Class MovingStars


[ Source | Index | Back to Nelzan ]

class MovingStars
extends Object
MovingStars - Displays stars that move at random speeds.

This class generates a variable number of stars, puts them at random locations, with random colors, and moves them at random speeds.


Variable Index

 o color
 o height
 o i
 o length
 o maxXMove
 o maxYMove
 o r
For generating random Numbers.
 o width
 o x
 o xMove
 o y
 o yMove

Constructor Index

 o MovingStars(int, int, int, int, int)
Creates All the data to draw MovingStars.

Method Index

 o abs(int)
Returns the distance from zero.
 o genStart()
Generates the stars starting location, everything is random.
 o paint(Graphics)
Paints the stars.
 o update()
Updates the stars location.

Variables

 o x
 private int x[]
 o y
 private int y[]
 o xMove
 private int xMove[]
 o yMove
 private int yMove[]
 o color
 private Color color[]
 o height
 private int height
 o width
 private int width
 o maxXMove
 private int maxXMove
 o maxYMove
 private int maxYMove
 o length
 private int length
 o r
 Random r
For generating random Numbers.

 o i
 int i

Constructors

 o MovingStars
 MovingStars(int width,
             int height,
             int maxX,
             int maxY,
             int count)
Creates All the data to draw MovingStars.

Parameters:
width - The width of the screen.
height - The height of the screen.
maxX - Max speed the stars move in the X direction.
maxY - Max speed the stars move in the Y direction.
count - The number of stars to display.

Methods

 o update
 public void update()
Updates the stars location. It will also generate a new star should the current one be outside of visual range.

 o paint
 public void paint(Graphics g)
Paints the stars.

Parameters:
g - Where to draw the stars.
 o genStart
 private void genStart()
Generates the stars starting location, everything is random.

 o abs
 private int abs(int i)
Returns the distance from zero.

Parameters:
i - The number to check.
Returns:
s an int of the distance from zero.
ND: VQ+, Mail, Shop, Free Web Hosting Star Wars Posters

NVDA Stock Chart
Copyrighted �, 2000, 2001 by NetDragons.com
Last Updated Saturday, December 5, 1998 - 20:46 EST