Say I had a map like the one displayed above. What would be the best method of creating a collision map for each individual state where I can click individually?
1 Answer
\$\begingroup\$
\$\endgroup\$
3
Convert your image to grey-scale. Make sure you have no two states that have the same grey. (You have to tweak the image.)
Have an infrastructure that maps the grey colour to a state.
Then when you mouse-over the map, pick the pixel colour that is under the mouse pointer, and search for it in the map.
You'll know what state you want to select this way.
-
-
\$\begingroup\$ Update: I managed to implement this. Now how would I go about changing the state's color when the mouse is over the state? \$\endgroup\$ Commented Apr 22, 2016 at 23:59
-
1\$\begingroup\$ @BruceTheGoose Post a new question :) You can link to this one here if it's relevant. \$\endgroup\$– Vaillancourt ♦Commented Apr 23, 2016 at 0:00