## Obtaining 'area' information from 'pictslider'

Nov 30, 2010 at 3:55pm

# Obtaining 'area' information from 'pictslider'

Hi there!

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?

Thanks!

Liam

[attachment=147544,1460] [attachment=147544,1461]

###### Attachments:
#53645
Nov 30, 2010 at 4:53pm

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!

Cheers,
SPF

#192886
Nov 30, 2010 at 5:59pm

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.

###### Attachments:
1. MRgeometry.zip
#192887
Nov 30, 2010 at 8:36pm

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…

#192888
Nov 30, 2010 at 8:51pm

Now there’s some handy, clever little things! Thanks MIB

#192889
Nov 30, 2010 at 9:10pm

Wow, thanks everyone! Really helpful stuff. If anyone’s interested I’ll upload the working patch when it’s finished.

#192890
Nov 30, 2010 at 11:51pm

Just realized that one set of abstractions is missing… sorry. This should be it though.

###### Attachments:
1. nTbMRr.zip
#192891
Dec 1, 2010 at 7:52am

Thanks you for sharing
_________________

http://moviesonlinefree.biz

#192892

You must be logged in to reply to this topic.