mapping x,y coordinates

Mar 25, 2015 at 8:21pm
I'm building a game similar to shuffleboard and am having trouble coming up with logic on mapping a segment of the board to a score. I am having trouble verbalizing (and therefore searching for): How can i create an image map that says: if i landed on block x then the score is 20? I have a function to convert x,y coordinates to a score, but I need to either 1) create an image with different colors and if the coordinate is on a certain color (getpixel) then the score is 20. is this the correct approach or is there something I am not considering? should i make a map of coordinates and correlate that to a score?

thanks.
Mar 25, 2015 at 9:24pm
Are you drawing this in a native window, or using a 3rd party graphics library?
Mar 26, 2015 at 12:57am
Native window
Mar 26, 2015 at 8:58am
Personally I would use your GetPixel() method. At least it seems the most straightforward approach. The only thing else I can think of is creating regions and using PtInRegion().
Mar 26, 2015 at 3:13pm
starting from the innermost circle and going out you can just use the circle center point and test for area/distance to see if the projectile has landed inside the bounds of the circle.

Edit: Specifically, if the distance from the projectile point to the circle center is smaller than the circle radius, it is inside the circle. If you work from inside to out would be easy to categorize score.
Last edited on Mar 26, 2015 at 3:14pm
Mar 27, 2015 at 3:35am
Ok. Good ideas. Let me see what i can work out.
Topic archived. No new replies allowed.