Forums > MaxMSP

### Obtaining 'area' information from 'pictslider'

Nov 30 2010 | 3:55 pm

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:
1. bullseye.png

Nov 30 2010 | 4:53 pm

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

Nov 30 2010 | 5:59 pm

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
Nov 30 2010 | 8:36 pm

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…

Nov 30 2010 | 8:51 pm

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

Nov 30 2010 | 9:10 pm

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

Nov 30 2010 | 11:51 pm

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

###### Attachments:
1. nTbMRr.zip
Dec 01 2010 | 7:52 am

Thanks you for sharing
_________________
http://moviesonlinefree.biz

Viewing 8 posts - 1 through 8 (of 8 total)

Forums > MaxMSP