tags:

views:

28

answers:

1

I am a new Android developer, and though I have spent a LOT of time reading through the official developer guide/reference (as well has hours of guessing/checking), I'm still stumped about the best way to do my layout. I am creating a board game, and here is an image of the game board. On that board, the game pieces live on (and move between) the small inner hexes. From my limited understanding of Android development, I'm thinking I need to make each small hex a view. And the overall board layout would be a stacking together of these small hex images to form the board shape. The end result would look exactly like the gameBoard image I linked above. IMPORTANT: I want the game board to be on the bottom of the screen, with game info (players, scores, etc.) at the top. For now I am focusing on a portrait layout...I'll deal with landscape mode later.

The trouble I'm having is figuring out how to do the layout. I want to use XML tags for this portion of the layout, because the board itself will never change during the game play. Only the game pieces will move around on the static board. I have spent hours so far researching and trying different layout types, and combinations of different layouts...nothing I've tried gives me that board design. As you can see from the board image, the hexes don't line up into nice rows/columns. I think this is why I am struggling to get my small hex views to look like the board. Any ideas? Or am I going about this in the wrong way altogether?

A: 

You say the board will not change, then why don't you use a single (vector) image to represent the whole board? I am not sure if android supports SVG though

GôTô
I'm open to that idea...but how would I move the pieces around the board? The reason I was thinking of doing views was so that each board hex (a playable location for the game pieces) could be interacted with by the player. For example, if I want to move a piece to an empty hex, I might tap the piece and then drag it to the empty hex. Letting go of the piece over the hex would trigger my game rules logic to validate the move, prompt for futher action, etc. Does that make sense? If I were to use an image, how would I do that?
Jake Munson
I think you should use an image because it would just be simpler and probably faster to draw the board that way. As to drawing the game pieces, I would create a structure that holds the x and y coordinates (in pixel) which you could point to using x and y hex position (say for example second hex from the left, first from the top would be (2,1) --> (20px, 5px))
GôTô