PDA

View Full Version : Clicking on a map


ExtraProgrammer
05-23-2006, 09:40 PM
Hi all,

I am thinking of doing something like a RISK-clone (just for fun), and is having a bit of problem handling how a map can be built. Ideally, the map shall be easy to build (preferably just drawing it in Paint or Photoshop), but how do I associate data or an unique id to each terrority?

I understand that the usual way is to use polygons, but that complicates the map-making process (and I sucks at the maths required, though I sure there's already-done solution somewhere). The other way is to chop each terrority into individual sprites, which is just as daunting.

Are there any other ideas? I was thinking of having a 'colour map' in memory, and use that map to look up each mouse click. For instance, China would be green, Mongalia another shade of green. With 16 millions colour, I can have an unique colour for each terrrority. Had anyone tried this before?

juhnu
05-23-2006, 10:37 PM
Yeah you could use assign each pixel a certain value. Works well and you could encode additional information for pixels, too. For a simple project like this, I would definitely go with a one single bitmap.