2

I'm developing a strategy game for Android using libGDX. It's loosely based on Risk and requires irregularly shaped regions. However, I am having trouble deciding how to detect when a player touches a point within one of these regions.

As of now, all I have is a full map image. One idea that I've thought of is to separate the image and create individual images for each region. Then, I can arrange them like a puzzle and check if the player has touched an opaque area of one of the regions.

Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
  • The thing is, irregular shaped can't really be formulated. But maybe there is a tool to do that which I am not aware of. IMHO, you already have a good idea, I think. – Ian Dec 26 '15 at 03:26
  • [Point-in-polygon](https://en.wikipedia.org/wiki/Point_in_polygon) test? – genpfault Dec 26 '15 at 03:52

1 Answers1

0

if your shaped regions are polygons defined as a set of points, you can use a algorithm to determine the point is inside or outsite like here.

or

i don´t lerned java, but maybe exist a control like html5 canvas hitregion.

user3104267
  • 190
  • 2
  • 10