Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads

 
suchitra chari
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a scenario, where a group of balls is hit by a single ball. On contact the group of balls are supposed to scattered. For this purpose, I have put each ball movement in a seperate thread. But when I run the threads, the movement is not smooth. They are jerky. Any solutions for this?
 
James Reilly
wrangler
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you considered giving each ball a "tick" method,
and having a Canvas with a thread that successively ticks
each object according to a virtual clock? The canvas
also being responsible for drawing the animation
too (in it's basic animation loop).
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!