Obtaining 'area' information from 'pictslider'
I'm creating simple visuals and game-play mechanics for a darts game as part of my masters degree (focused on audio for interactivity). I'm using a pictslider for the dart board, using the knob as the cross-hair for aiming your dart. So far I've got a system that will add the darts together as you go through each turn, automatically subtract the input scores and switch between the two players at the end of their go.
What I'm currently struggling to do is figure out a way to calculate which number you have hit from the two pictslider outputs.
I've been trying to use 'if' statements to determine if the player is within a certain area of the dartboard but am having trouble defining these areas in the first place. For example I have only been able to make a square area for the bullseye when ideally I'd need a more circular one.
This may just be my lack of understanding of mathematical functions but does anyone know a way that I can define the separate triangular and circular areas of the dart board from the pictslider outputs, or alternatively if there is a better object to use than a pictslider to achieve what I am trying to do?
Switch to polar coordinates… cartopol and poltocar… look into your old geometry text. Then you’ll just be working with angles and radii, which is exactly how a dartboard is laid out to begin with!
I started putting together some abstraction to deal with simple geometry. I am attaching them here. Have a look at the MRpointInCircle helpfile.
Hope this is helpful. Let me know if there are any questions, requests, bugs…
Other than that, spf006′s suggestion is the way to go.
Looking forward to seeing what you’ve got in there MIB. Dealing with non-rectangular areas is a pain unless you can work with different colors for every area. So if you had a hidden second dartboard that was color-corrected, so each and every area was a unique color, you could use [suckah] and compare to a master list. Other than that, definitely look to polar coordinates.
It would be really nice to have a built-in way to define non-rectangular areas in Max, that’s one place where Flash wins big time. Even if all you had was rectangles, circles, and a line tool (like defining "hot areas" on an image map for a web page), that would be great for certain applications.
Anyway, best of luck. Darts fun…
Now there’s some handy, clever little things! Thanks MIB
Wow, thanks everyone! Really helpful stuff. If anyone’s interested I’ll upload the working patch when it’s finished.
Just realized that one set of abstractions is missing… sorry. This should be it though.
Thanks you for sharing