Results 1 to 7 of 7
Thread: Making a dartboard
 06222010, 08:22 AM #1Member
 Join Date
 Jun 2010
 Posts
 8
 Rep Power
 0
Making a dartboard
Hello,
my problem is that I want to make a program to simulate games of playing darts. What I need to do is to have image/model of dart board, and user just clicks on areas where he, let's say, threw his dart, and it will count his score (like 20, double 15, 6 etc...).
Problem is, how do I determine what number did he score from dart board image ? Or is there better approach ? How would you build a program like this ?
Thanks for help!
 06222010, 01:11 PM #2how do I determine what number did he score from dart board image
If you build the display of the board in the program you could use polygons to map the different areas. Not quite a tedious but takes a bit of time it get it to look right.
 06222010, 01:57 PM #3
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,017
 Blog Entries
 7
 Rep Power
 23
You can also find the score mathematically: a dartboard is divided in 20 equal regions with an angle with of 2*PI/20 each. For each region you can find the start angle and the end angle (which is the start angle + 2*PI/20 radians). A small array with the scores maps the angle to a basic score.
The second measurement is the distance from the midpoint; if it is less than r (I don't know that value) you have hit the bulls eye; if it is less than r2 > r you have hit the area next to the bull's eye etc. for triple score and double score.
The Math.atan2(double y, double x) method can find the angle measured in radians for you.
kind regards,
Jos
 06222010, 02:45 PM #4Member
 Join Date
 Jun 2010
 Posts
 8
 Rep Power
 0
That's what I though :)
was only curious whether there isn't some other way in Java for this, because as exC programmer it surprises me every day !
Thanks anyway!Last edited by MarsTeam; 06222010 at 02:53 PM.
 06222010, 03:12 PM #5
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,017
 Blog Entries
 7
 Rep Power
 23
 06222010, 07:44 PM #6Member
 Join Date
 Jun 2010
 Posts
 8
 Rep Power
 0
 06222010, 07:54 PM #7
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,017
 Blog Entries
 7
 Rep Power
 23
Similar Threads

how can I draw a board in 2d array?
By java_fun2007 in forum New To JavaReplies: 8Last Post: 12282011, 06:58 PM 
How to do a score board?
By vlan in forum Java AppletsReplies: 11Last Post: 06032010, 10:10 AM 
need help making a game board
By Don k in forum New To JavaReplies: 2Last Post: 04302010, 12:09 AM 
game board design
By tomitu in forum New To JavaReplies: 12Last Post: 02272010, 06:31 PM 
how to create board in java...
By zenith in forum New To JavaReplies: 5Last Post: 01202010, 05:42 AM
Bookmarks