How is that? Is it some kind of magic?
What is the purpose of assigning values to the three variables if they are not being used?
Type: Posts; User: Norm
How is that? Is it some kind of magic?
What is the purpose of assigning values to the three variables if they are not being used?
myX = Math.random() * 200 - 99;//star starts in a small square
myY = Math.random() * 200 - 99;//in the center
myLayer = Math.random() * 3;//random layer
stars[index] = new...
When you get errors that you don't understand, you need to post them instead of ignoring them.
public void Star(double myX, double myY, double myLayer)
That is not a constructor. Constructors do NOT have a void. This is the line of code I have mentioned in posts 2, 10 and 16.
Also look at...
Where is the code for the Star class's constructor?
There is a method in the class that looks like a constructor. Why not convert that to be a constructor and use it?
Make the variables that belong...
stars[index] = new Star();//fill array with stars
Why don't you use the "constructor" method to fill in the values when the Star object is created?
Where is the Thread to run the loop creating...
Then you need to put the code in a method.
Yes, in most cases.
Most executed statements should be in a method. Statements that Initialize variables can be outside.
To rewrite your StarScape program, take the do while loop out of the paint method. Just two lines with the do and the while, leave the contents of the loop.
Create a thread and put the do while loop...