• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Ball Physics implementation.

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear experts,

I wanted to implement ball physics and as i m newbie, i adapt the code in tutorial
http://adam21.web.officelive.com/Documents/JavaPhysicsTutorial.pdf.

i try to follow that as i much as i can,
but i m not able to apply all physical phenomenon in code, can somebody please tell me, where i m mistaken or i m still doing some silly programming mistake , the balls are moving when i m not calling bounce method and i m unable to avail the bounce method and ball are moving towards left side instead of falling/ending on floor,


Can some body can recommend me some better way or similar way to accomplish this task of applying physics on two ball or more balls ,

here is code ;



using Adobeball




load of thanks
jibby
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a lot of code to go through -- so I'm not.

But when my program logic doesn't work as I desire it to, I put on my debugging hat and start debugging like crazy. If you haven't already done so, either use a decent debugger or pepper your code with printlns so that you can see why the program is not behaving as it should.

Best of luck.
 
Jibby Lala
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i ordered a DEBUG HAT BUT i thought it will take time to reach as i m newbie
ok, then can you please shift this thread to "game development" section or most likely place to get answer.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> ...or most likely place to get answer.

as we can't compile it, or run it, the most likely place is where people enjoy reading --> the library
 
Jibby Lala
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why you can't compile or run it?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
private MyKeyListener pit;
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a well working code of the two dimensional ball collision, maybe it can help you.
 
Jibby Lala
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please add this :

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> Please add this :

all you are doing is wasting our time:

you have this
private MyKeyListener pit;
pit = new MyKeyListener();

now you've (finally, what 10 days?) posted the MyKeyListener class.

so how do you expect to compile/run with these lines
frame.addMouseListener(pit);
frame.addMouseMotionListener(pit);

perhaps you'll put in a better effort at your (at least) 2 cross-posts
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic