How best to tackle developing a darts game?
Monkey Archive Forums/Digital Discussion/How best to tackle developing a darts game?
| ||
I've been asked to look at writing a darts game, and I've decided to use the opportunity to give Monkey a whirl. As a long time Blitz user, I can't wait to get stuck in! Can anyone suggest how best to approach implementing the board? I.e. what's the simplest/most efficient way of determining where on the board the dart has hit? Does anyone know where I might find some sample code? I remember Gfk creating a great dart game, in Blitz, some time ago. Is it still possible to buy/download it? Thanks |
| ||
As a dart-board is segmented into sectors and radial bands it's probably easiest to use the angle and distance from the centre point. |
| ||
What muddyshoes said. That's how I did it for Double Top. Don't think you can get it any more but I still have the source code and stuff. ;) |
| ||
Thanks guys. I don't suppose you could throw a few example calculations my way, could you GfK? ;) |
| ||
Watch this. Then duplicate. :-D |
| ||
I'm actually making a darts game prototype myself and got the flick functionality working over the weekend with some "wind". Was debating making an archery game instead.... might still do that anyway. My Distance to the center code: (sorry, don't know how to use forum markup to put in a code box) Local DistanceToCenter:Float DistanceToCenter = Sqrt(((centerX-dartX)*(centerX-dartX)) + ((centerY-dartY)*(centerY-dartY))) I can do this for each ring. Then the Angle between the 2 points so you know where you are on the board: You would use some implementation of ATan2 kind-of like: Local Angle:Float Angle = ATan2(dartX-centerX, dartY-startY) Of course you'd probably have to fiddle with these a bit to get them working. Depending on your implementation, centerX/dartX and Y's may have to be reversed, or you may want to add 180 to the ATan2 if you want 0/360 to be straight up (if I remember correctly). |
| ||
Great! Thanks benmc. Much appreciated. |
| ||
@ben - I think an archery game would appeal to a much wider audience. |
| ||
The archery could also tie in with the recent movie about the girl with archery skillz who had to battle for her life before a television audience. I can't remember the name right now. The Hunter Games? HUNGER GAMES?!! No... YES!!! My daughter said "Hunger Games." I knew it. Anyway... |
| ||
Agreed, I think between Brave and The Hunger Games, the weapon of choice for heroines in 2012 had to be the bow and arrow :) |
| ||
@milky - got an email address? |
| ||
Well we used to badger Gfk for a rotating dartboard, never did get it tho. |
| ||
<email address removed> Cheers! |
| ||
Well we used to badger Gfk for a rotating dartboard, never did get it tho. I have a partly finished 'sequel' to Double Top which I wrote in 2005, which does have a rotating board.@joe: check mailz. |
| ||
If your planning to sell a dart game, I wouldnt bother.... I made one, and, their not that popular, really, they arent, I sold two games for iOS, one a battleship type game, and a dart game, the battleship game got loads, the dart game, not so much! If it's for freeware, well, fair do's, if not, be warned! :) Dabz |
| ||
There is darts game called Darts Night on ipad which is great but hard to get hang of when you try get 180 often |