Results 1 to 7 of 7
Thread: Making a dart-board
- 06-22-2010, 08:22 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 8
- Rep Power
- 0
Making a dart-board
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!
- 06-22-2010, 01:11 PM #2
You'll need to map the x,y positions for each section. That's usually done manually if the board is an image. You write a simple mapping program that shows where the mouse click is and save those x,y positions for the corners of each area. Very tedious.how 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.
- 06-22-2010, 01:57 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,588
- Blog Entries
- 7
- Rep Power
- 17
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
- 06-22-2010, 02:45 PM #4
Member
- 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 ex-C programmer it surprises me every day !
Thanks anyway!Last edited by MarsTeam; 06-22-2010 at 02:53 PM.
- 06-22-2010, 03:12 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,588
- Blog Entries
- 7
- Rep Power
- 17
- 06-22-2010, 07:44 PM #6
Member
- Join Date
- Jun 2010
- Posts
- 8
- Rep Power
- 0
- 06-22-2010, 07:54 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,588
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
how can I draw a board in 2d array?
By java_fun2007 in forum New To JavaReplies: 8Last Post: 12-28-2011, 05:58 PM -
How to do a score board?
By vlan in forum Java AppletsReplies: 11Last Post: 06-03-2010, 10:10 AM -
need help making a game board
By Don k in forum New To JavaReplies: 2Last Post: 04-30-2010, 12:09 AM -
game board design
By tomitu in forum New To JavaReplies: 12Last Post: 02-27-2010, 05:31 PM -
how to create board in java...
By zenith in forum New To JavaReplies: 5Last Post: 01-20-2010, 04:42 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks