Re: Challenge: I need an animation loop outside of the paint method.
Code :
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 Star();//fill array with stars
Why are you creating new values for the three variables if they are not being passed to the constructor?
Re: Challenge: I need an animation loop outside of the paint method.
they do get in there though. the random numbers get to the constructor because I did not declare them private. I was having a problem using the random in the constructor because my star.class was put together a little unorthodox. Random works in there now.
Re: Challenge: I need an animation loop outside of the paint method.
Quote:
they do get in there though
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?
Re: Challenge: I need an animation loop outside of the paint method.
It did work, how ever my code has been polished and the random generators are now in the constructor. Infact new values are no longer created like that, myX, myY, ect only get values set to them during a call to get methods. thank you for all your help, my StarScape is now worthy to be put in my portfolio.