1
\$\begingroup\$

My problem is, I want to create a 2D tiled map. Yes, I know it's been asked a lot. I've seen answers that propose the use of tiled however it only allows (or so it seems to me) to generate static maps that do not change once generated. And I need a large empty uniform space of empty tiles, upon which players may place various buildings (some spanning more than one tile and logically being the same one).

How to approach this in Android? Do I make some kind of TableLayout, use arbitrarly large amount of rows and imageviews (with my emptyTile), than somehow work event-based changing of image ids from there? I'd think that only a portion of that map should be visible at a time, but I don't see how scrolling around could be the part of that structure.

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

Have you considered using libgdx? It's a Java game development framework (you really want to use a framework if you want to develop Android games) that allows your code to run on desktop, Android, iOS, and HTML5. It's commonly used to focus on the Android part, and you can see that on the Tiled support page, libgdx is listed (under Java).

Tile-based platformers are a very common approach, and it's very easy in libgdx. In fact, this tutorial, which is listed on the libgdx tutorial list, shows you how to implement a tile-based platformer.

To relate to your question specifically: no, the map does not have to be static. Tiled just provides you with an easy map creation method. The file that Tiled provides can be accessed through libgdx (see the documentation here). Once loaded, that file can be treated like any other TiledMap object. Again, you really don't want to do this through the default Android libraries.

Just so you know, AndEngine, another Java game development framework for Android, can also use Tiled (according to that page). I have no experience with that framework, however, and you'll have to do your own research to decide which one you want to use.

\$\endgroup\$

You must log in to answer this question.

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