• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using threads

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

I would really appreciate your help with a program that has been bugging me for over a week now.

Essentially I am using threads to control balls within a Jframe (10 balls). When i click within the frame the balls start their motion again from this point. There is also a 10 pixel wide invisible line down the center of the frame that the ball rebound off when they hit it.

What i would like to achieve is for the balls to rebound of the wall if they are designated as even as stick to the wall if they are odd. I have worked out that I will need to use a modulo such as i%2==1 to work out whether it is odd for example.

I would appreciate your time and suggestions.

(there is a 'ball' class that I have not included so as to keep the problem area as concise as possible)

 
Michael Chapman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please take a look someone!

Thanks
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It might help if you are a bit more specific about the issue you are facing
 
"To do good, you actually have to do something." -- Yvon Chouinard
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic