We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Score Board (Read 846 times)
Score Board
Dec 3rd, 2009, 4:31pm
 
I was wondering if there is anyway to have a little thing that counts how many times a ball hits a target.

THX,
      The Lonkinator Smiley
Re: Score Board
Reply #1 - Dec 3rd, 2009, 7:21pm
 
you can use an "intersect" function.  there are examples in the shiffman book on processing.
Re: Score Board
Reply #2 - Dec 3rd, 2009, 9:35pm
 
this is the example http://www.learningprocessing.com/examples/chapter-10/example-10-3/

he uses dist() to calculate the distance between two objects. if the distance gets under a certain value do X.

http://processing.org/reference/dist_.htm

depending on how your object moves and how your target looks like you have to figure out how to prevent the counter from counting up only once the target it hit. and not as long as it "touches" the target.
Re: Score Board
Reply #3 - Dec 4th, 2009, 1:31am
 
So unless you have some kind of bounce mechanism built in you need to determine both the conditions for a 'hit' and a 'release'...
Page Index Toggle Pages: 1