Search:

Type: Posts; User: Norm

Search: Search took 0.14 seconds.

  1. Re: Challenge: I need an animation loop outside of the paint method.

    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?
  2. Re: Challenge: I need an animation loop outside of the paint method.

    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...
  3. Re: Challenge: I need an animation loop outside of the paint method.

    When you get errors that you don't understand, you need to post them instead of ignoring them.
  4. Re: Challenge: I need an animation loop outside of the paint method.

    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...
  5. Re: Challenge: I need an animation loop outside of the paint method.

    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...
  6. Re: Challenge: I need an animation loop outside of the paint method.

    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...
  7. Re: Challenge: I need an animation loop outside of the paint method.

    Then you need to put the code in a method.
  8. Re: Challenge: I need an animation loop outside of the paint method.

    Yes, in most cases.

    Most executed statements should be in a method. Statements that Initialize variables can be outside.
  9. Re: Challenge: I need an animation loop outside of the paint method.

    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...
Results 1 to 9 of 9