Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bumper car simulation

807589Nov 25 2008 — edited Nov 26 2008
Hi!

I haven't yet started to code because I don't know where to begin. I have to produce a bumper car simulation consisted of a frame and two circles moving inside, bouncing off walls and each other. The question is: how to make the circles(bumper cars) move and how to make them bounce off walls and each other? Their initial position will be randomized inside the bordered panel and the two cars would have the same speeds (I believe that would be the simplest solution). Perhaps I could use the timer and refresh the Ellipse2D.Double object every 0.1 seconds? And find the method that would check when the cars areas would overlap to change the velocity relative to the position of the other object? Even if I manage to code that, the walls are still the problem.

In addition, perhaps user could enter the number of cars inside the frame but that is still SF for now.

Thanks,

Slaven
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 24 2008
Added on Nov 25 2008
15 comments
363 views