I want to have a selectable map of the world, preferably zoomable, in a cocos2d project. When I tap on a country, I want that country to be selected so that I can perform some other operations with it. It seems that the best approach would be to use a vector world map, but I'm unsure how to implement this with cocos2d. Other options include using map tiles, but it seems that still would require the implementation of country polygons for tap/click detection.

Depending on user input, I want to add icons to various countries on the map.

What is a good way to approach the implementation of this type of map?


1 Answer 1


I would likely create CGRects using node/world coordinates, I can never remember which is which until I do it, of where the picture of this place would be. That way instead of creating separate sprite entities for every city you could just create one map with everything on it. Then when you tap the country, you're really just getting the detection against the CGRect in the same position.

I also might instead make a circle or something to place under the countries and create the circle as CCMenus. Alternatively, you could create them as sprites as well that sit under the map.

As far as the zooming in and out and using a vector map I'm not sure. Depending on how much zoom you wanted I don't know if it would be necessary but I'm also not sure what you're doing.

Hopefully there is a better answer than mine because I'm sort of curious as to how someone else would do this.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .