Question: Using Eclipse with javafx application: 1. Create a class called ParticleController in the edu.kettering.cs101 package that extends javafx Application 2. In the ParticleController implement the

Using Eclipse with javafx application:

1. Create a class called ParticleController in the edu.kettering.cs101 package that extends javafx Application 2. In the ParticleController implement the main method to launch the app 3. In the ParticleController implement the start method 4. In the ParticleController create an array of 20 Circle Objects 5. Create the Circle Objects in the start method and add the circles to the root to be displayed 6. At the end of the start method add the following code to run animation Make sure to declare the required variables if (thread == null) { thread = new Thread() { public void run() { while(true) { if (running) { runLoop(); } try { Thread.currentThread().sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } } } }; thread.start(); 7. Implement the runLoop method in the ParticleController class 8. When creating the circles initialize the radius to 40. Randomly initialize the X and Y positions 9. Create a double array for storing the circle x velocity 10. Create a double array for storing the circle y velocity 11. Randomly initialize the x and y velocity values between -20 and +20 12. In the runLoop method adjust the corresponding circle x and y position by adding the velocity values 13. Create a collisionCheck method which is called at the end of the runLoop method 14. In the collisionCheck method loop through each circle (i), then loop through all other circles (j) Calculate the distance between the 2 circles. If the distance is less than 80, then reverse and reduce (0.8) both the x and y velocity

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!